Esempio n. 1
0
 if ($credit_amount > 0) {
     $credit_note_desc = 'Refund of balance for Invoice: ' . pad($previous_invoice, 11, '0');
     $filename = generate_random_string_of(8) . '.' . generate_random_string_of(8);
     $issued_on = today();
     $expire_on = sql_date_add($issued_on, 30, 'day');
     Invoice::accompany_credit_note_with($previous_invoice, $invoice, $issued_on, $credit_amount);
     $branch = $employer->get_branch();
     $sales = 'sales.' . strtolower($branch[0]['country']) . '@yellowelevator.com';
     $branch[0]['address'] = str_replace(array("\r\n", "\r"), "\n", $branch[0]['address']);
     $branch['address_lines'] = explode("\n", $branch[0]['address']);
     $currency = Currency::getSymbolFromCountryCode($branch[0]['country']);
     $pdf = new CreditNote();
     $pdf->AliasNbPages();
     $pdf->SetAuthor('Yellow Elevator. This credit note was automatically generated. Signature is not required.');
     $pdf->SetTitle($GLOBALS['COMPANYNAME'] . ' - Credit Note ' . pad($invoice, 11, '0'));
     $pdf->SetRefundAmount($credit_amount);
     $pdf->SetDescription($credit_note_desc);
     $pdf->SetCurrency($currency);
     $pdf->SetBranch($branch);
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetTextColor(255, 255, 255);
     $pdf->SetFillColor(54, 54, 54);
     $pdf->Cell(60, 5, "Credit Note Number", 1, 0, 'C', 1);
     $pdf->Cell(1);
     $pdf->Cell(33, 5, "Issuance Date", 1, 0, 'C', 1);
     $pdf->Cell(1);
     $pdf->Cell(33, 5, "Creditable By", 1, 0, 'C', 1);
     $pdf->Cell(1);
     $pdf->Cell(0, 5, "Amount Creditable (" . $currency . ")", 1, 0, 'C', 1);
     $pdf->Ln(6);