$SUBTOTAL2 = $f['SUBTOTAL2']; $SUBTOTAL3 = $f['SUBTOTAL3']; $SUBTOTAL4 = $f['SUBTOTAL4']; $TAX1 = $f['TAX1_TOTAL']; $TAX2 = $f['TAX2_TOTAL']; $TAX3 = $f['TAX3_TOTAL']; $TAX4 = $f['TAX4_TOTAL']; $TAX1_DESC = $f['TAX1_DESC']; $TAX2_DESC = $f['TAX2_DESC']; $TAX3_DESC = $f['TAX3_DESC']; $TAX4_DESC = $f['TAX4_DESC']; $TOTAL = $f['TOTAL_AMOUNT']; $MESSAGEID = $f['MESSAGE_DESC']; } } $PrintD = Print_Date($Date); if ($Type == 'Invoice') { $FileName = "{$a['invoice_initials']}-{$PrintD}-{$ID}"; $Subject = "{$a['invoice']} - {$a['invoice_number']}: {$FileName}, {$a['customer_no']}: {$MYID}, {$a['date_text']}: {$Date}"; $sendfile = $PDFDirectory . $FileName . '.pdf'; $_SESSION['Type'] = "{$a['invoice_number']}"; } else { $FileName = "{$a['delivery_note_initials']}-{$PrintD}-{$ID}"; $Subject = "{$a['delivery_note']} - {$a['delivery_note_number']}: {$FileName}, {$a['customer_no']}: {$MYID}, {$a['date_text']}: {$Date}"; $sendfile = $PDFDirectory . $FileName . '.pdf'; $_SESSION['Type'] = "{$a['delivery_note_number']}"; } $posquery = $db->Execute("SELECT P.POSITIONID, P.POS_NAME, V.INVOICEID, V.POSITIONID, V.POS_DESC,\n\tV.POS_QUANTITY, V.POS_PRICE, V.TAX, V.TAX_DIVIDE, V.TAX_MULTI, V.TAX_DESC FROM {$TBLName}article AS P, {$TBLName}invoicepos AS V WHERE P.POSITIONID=V.POSITIONID AND V.INVOICEID={$invoiceID} ORDER BY V.POS_GROUP ASC, V.INVOICEPOSID ASC"); // Print text if invoice is paid // $paid = $db->Execute("SELECT METHOD_OF_PAY, INVOICEID, SUM_PAID, DATE_FORMAT(PAYMENT_DATE,'%d.%m.%Y') AS PAYMENT_DATE\n\t\t\tFROM {$TBLName}payment WHERE CANCELED=2 AND INVOICEID={$invoiceID}");
$smarty->assign("NR_MESSAGE", $f['MESSAGE']); } else { $smarty->assign("NR_MESSAGE", $messageID); } } } } // Get the last entry from table 'angebot' // $query2 = $db->GetRow("SELECT MAX(OFFERID) AS MAX_OFFERID FROM {$TBLName}offer"); if (!$query2) { print $db->ErrorMsg(); } else { $OfferID = $query2['MAX_OFFERID'] + 1; } $PrintD = Print_Date($OfferDate); $smarty->assign("PrintDate", $PrintD . '-' . $OfferID); $smarty->assign("OfferID", "{$OfferID}"); $smarty->assign("OFFER_DATE", $OfferDate); $posquery = $db->Execute("SELECT P.POSITIONID, P.POS_NAME, T.USERNAME, T.POSITIONID, T.POS_DESC, T.POS_QUANTITY, T.POS_PRICE, T.TAX, T.TAX_DIVIDE, T.TAX_MULTI, T.TAX_DESC, T.POS_GROUP, T.TMP_OFFERID FROM {$TBLName}article AS P, {$TBLName}tmp_offer AS T WHERE P.POSITIONID=T.POSITIONID ORDER BY T.POS_GROUP ASC, T.POS_DESC ASC"); $numrows = $posquery->RecordCount(); // Calculate positions // require_once '../include/pos.inc.php'; // Get the method of payment from database // $query5 = $db->Execute("SELECT METHODOFPAYID, DESCRIPTION FROM {$TBLName}methodofpay ORDER BY DESCRIPTION ASC"); $query6 = $db->Execute("SELECT MESSAGEID, DESCRIPTION FROM {$TBLName}message ORDER BY DESCRIPTION ASC"); // If an error has occurred, display the error message // if (!$query5) {
$smarty->assign("CITY", $f['CITY']); $smarty->assign("POSTALCODE", $f['POSTALCODE']); $smarty->assign("COUNTRY", $f['COUNTRY']); $smarty->assign("PRINT_NAME", $f['PRINT_NAME']); $smarty->assign("METHOD_OF_PAY", $f['METHOD_OF_PAY']); $smarty->assign("METHOD_OF_PAY_DATE", $f['METHOD_OF_PAY_DATE']); $smarty->assign("TOTAL_AMOUNT", $f['TOTAL_AMOUNT']); $smarty->assign("NOTE", $f['NOTE']); $smarty->assign("PAID", $f['PAID']); $smarty->assign("SUM_PAID", $f['SUM_PAID']); $smarty->assign("OPEN_ACCOUNT", $f['TOTAL_AMOUNT'] - $f['SUM_PAID']); $smarty->assign("MESSAGEID", $f['MESSAGE_DESC']); $smarty->assign("CANCELED", $f['CANCELED']); } } $PrintD = Print_Date($InvoiceDate); $smarty->assign("PrintDate", $PrintD . '-' . $InvoiceID); $smarty->assign("INVOICE_DATE", $InvoiceDate); $posquery = $db->Execute("SELECT P.POSITIONID, P.POS_NAME, V.POSITIONID, V.POS_DESC, V.POS_QUANTITY, V.POS_PRICE, V.POS_GROUP, V.INVOICEID, V.INVOICEPOSID, V.TAX, V.TAX_DIVIDE, V.TAX_MULTI, V.TAX_DESC FROM {$TBLName}article AS P, {$TBLName}invoicepos AS V WHERE P.POSITIONID=V.POSITIONID AND V.INVOICEID={$invoiceID} ORDER BY V.POS_GROUP ASC, V.INVOICEPOSID ASC"); $numrows = $posquery->RecordCount(); // Calculate positions // require_once '../include/pos.inc.php'; // Print text if invoice is paid // $paid = $db->Execute("SELECT METHOD_OF_PAY, INVOICEID, SUM_PAID, DATE_FORMAT(PAYMENT_DATE,'%d.%m.%Y') AS PAYMENT_DATE\n\t\tFROM {$TBLName}payment WHERE CANCELED=2 AND INVOICEID={$invoiceID}"); // Save all entrys in $PaymentData array // foreach ($paid as $paidresult) { $PaymentData[] = $paidresult; }