Merge branch 'akaunting:master' into master
This commit is contained in:
		@@ -65,9 +65,11 @@ class Invoices extends Controller
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function printInvoice(Document $invoice, Request $request)
 | 
					    public function printInvoice(Document $invoice, Request $request)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $invoice = $this->prepareInvoice($invoice);
 | 
					        event(new \App\Events\Document\DocumentPrinting($invoice));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return view($invoice->template_path, compact('invoice'));
 | 
					        $view = view($invoice->template_path, compact('invoice'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -79,32 +81,23 @@ class Invoices extends Controller
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function pdfInvoice(Document $invoice, Request $request)
 | 
					    public function pdfInvoice(Document $invoice, Request $request)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $invoice = $this->prepareInvoice($invoice);
 | 
					        event(new \App\Events\Document\DocumentPrinting($invoice));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $currency_style = true;
 | 
					        $currency_style = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $view = view($invoice->template_path, compact('invoice', 'currency_style'))->render();
 | 
					        $view = view($invoice->template_path, compact('invoice', 'currency_style'))->render();
 | 
				
			||||||
        $html = mb_convert_encoding($view, 'HTML-ENTITIES');
 | 
					        $html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $pdf = \App::make('dompdf.wrapper');
 | 
					        $pdf = app('dompdf.wrapper');
 | 
				
			||||||
        $pdf->loadHTML($html);
 | 
					        $pdf->loadHTML($html);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //$pdf->setPaper('A4', 'portrait');
 | 
					        //$pdf->setPaper('A4', 'portrait');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $file_name = 'invoice_' . time() . '.pdf';
 | 
					        $file_name = $this->getDocumentFileName($invoice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $pdf->download($file_name);
 | 
					        return $pdf->download($file_name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected function prepareInvoice(Document $invoice)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $invoice->template_path = 'sales.invoices.print_' . setting('invoice.template' ,'default');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        event(new \App\Events\Document\DocumentPrinting($invoice));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $invoice;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function signed(Document $invoice)
 | 
					    public function signed(Document $invoice)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (empty($invoice)) {
 | 
					        if (empty($invoice)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,7 +122,7 @@ return [
 | 
				
			|||||||
    | This options indicates the allowed languages.
 | 
					    | This options indicates the allowed languages.
 | 
				
			||||||
    |
 | 
					    |
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    'allowed'       => ['ar-SA', 'az-AZ', 'bg-BG', 'bn-BD', 'bs-BA', 'ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-US', 'es-AR', 'es-ES', 'es-MX', 'fa-IR', 'fr-FR', 'he-IL', 'hi-IN', 'hr-HR', 'hu-HU', 'id-ID', 'is-IS', 'it-IT', 'ja-JP', 'ka-GE', 'ko-KR', 'lt-LT', 'lv-LV', 'mk-MK', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sq-AL', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'ur-PK', 'uz-UZ',  'vi-VN', 'zh-CN', 'zh-TW'],
 | 
					    'allowed'       => ['ar-SA', 'az-AZ', 'bg-BG', 'bn-BD', 'bs-BA', 'ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-US', 'es-AR', 'es-ES', 'es-MX', 'et-EE', 'fa-IR', 'fr-FR', 'he-IL', 'hi-IN', 'hr-HR', 'hu-HU', 'id-ID', 'is-IS', 'it-IT', 'ja-JP', 'ka-GE', 'ko-KR', 'lt-LT', 'lv-LV', 'mk-MK', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sq-AL', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'ur-PK', 'uz-UZ',  'vi-VN', 'zh-CN', 'zh-TW'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
    |--------------------------------------------------------------------------
 | 
					    |--------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,13 +10,13 @@ return [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    'minor'     =>  '1',
 | 
					    'minor'     =>  '1',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'patch'     =>  '15',
 | 
					    'patch'     =>  '16',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'build'     =>  '',
 | 
					    'build'     =>  '',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'status'    =>  'Stable',
 | 
					    'status'    =>  'Stable',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'date'      =>  '30-May-2021',
 | 
					    'date'      =>  '10-Jun-2021',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'time'      =>  '15:00',
 | 
					    'time'      =>  '15:00',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user