X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fdoctext.inc;h=f39254afee2f4a8fd830c47fd5188f43231b6296;hb=7e830126b96477e969fe3b48d9fc0e78f6c1fe00;hp=e296ead38beb4b96d1181feae59c7b90afe1d645;hpb=565a41e2d7fd4b4a32848e4829c11dbbcb5881d1;p=fa-stable.git diff --git a/reporting/includes/doctext.inc b/reporting/includes/doctext.inc index e296ead3..f39254af 100644 --- a/reporting/includes/doctext.inc +++ b/reporting/includes/doctext.inc @@ -30,7 +30,19 @@ _("Unit"), _("Price"), _("Discount %"), _("Total")); // for links use 'text' => 'url' - $Footer[0] = _("All amounts stated in") . @$this->formData['curr_code']; + $Footer[0] = _("All amounts stated in") . " - " . @$this->formData['curr_code']; + + if (!in_array($this->formData['doctype'], array(ST_STATEMENT, ST_WORKORDER))) + { + $id = $this->formData['payment_terms']; + $sql = "SELECT terms, days_before_due FROM ".TB_PREF."payment_terms WHERE terms_indicator=".db_escape($id); + $result = db_query($sql,"could not get paymentterms"); + $row = db_fetch($result); + $Payment_Terms = _("Payment Terms") . ': ' . $row["terms"]; + if ($this->formData['doctype'] == ST_SALESINVOICE && $this->formData['prepaid']) + $this->formData['prepaid'] = ($row['days_before_due'] >= 0) ? 'final' : 'partial'; + } + switch ($this->formData['doctype']) { @@ -38,28 +50,30 @@ $this->title = _("SALES QUOTATION"); $this->formData['document_name'] =_("Quotation No."); $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $this->formData['order_no']; + $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + ? $this->formData['reference'] : $this->formData['order_no']; $aux_info = array( _("Customers Reference") => $this->formData["customer_ref"], _("Sales Person") => get_salesman_name($this->formData['salesman']), - _("Your VAT no.") => '', - _("Our Order No") => '', + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Quotation No") => $this->formData['order_no'], _("Valid until") => sql2date($this->formData['delivery_date']), ); break; case ST_SALESORDER: - $this->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER")); + $this->title = ($print_as_quote==1 ? _("QUOTE") : ($this->formData['prepaid'] ? _("PREPAYMENT ORDER") : _("SALES ORDER"))); $this->formData['document_name'] =_("Order No."); $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $this->formData['order_no']; + $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + ? $this->formData['reference'] : $this->formData['order_no']; $this->formData['document_amount'] = $this->formData['order_no']; $aux_info = array( _("Customers Reference") => $this->formData["customer_ref"], _("Sales Person") => get_salesman_name($this->formData['salesman']), - _("Your VAT no.") => '', - _("Our Order No") => '', + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => $this->formData['order_no'], _("Delivery Date") => sql2date($this->formData['delivery_date']), ); break; @@ -88,7 +102,7 @@ case ST_CUSTCREDIT: $this->title = _("CREDIT NOTE"); $this->formData['document_name'] =_("Credit No."); - $Footer[0] = _("Please quote Credit no. when paying. All amounts stated in") . $this->formData['curr_code']; + $Footer[0] = _("Please quote Credit no. when paying. All amounts stated in") . " - " . $this->formData['curr_code']; $aux_info = array( _("Customers Reference") => @$this->formData["customer_ref"], @@ -100,10 +114,11 @@ break; case ST_SALESINVOICE: - $this->title = _("INVOICE"); + $this->title = $this->formData['prepaid']=='partial' ? _("PREPAYMENT INVOICE") + : ($this->formData['prepaid']=='final' ? _("FINAL INVOICE") : _("INVOICE")); $this->formData['document_name'] =_("Invoice No."); $this->formData['domicile'] = $this->company['domicile']; - $Footer[0] = _("Please quote Invoice no. when paying. All amounts stated in"). $this->formData['curr_code']; + $Footer[0] = _("Please quote Invoice no. when paying. All amounts stated in"). " - " . $this->formData['curr_code']; $deliveries = get_sales_parent_numbers(ST_SALESINVOICE, $this->formData['trans_no']); if ($print_invoice_no == 0) @@ -116,9 +131,18 @@ _("Customers Reference") => $this->formData["customer_ref"], _("Sales Person") => get_salesman_name($this->formData['salesman']), _("Your VAT no.") => $this->formData['tax_id'], - _("Delivery Note No.") => implode(',', $deliveries), - _("Due Date") => sql2date($this->formData['due_date']), ); + if ($this->formData['prepaid']=='partial') + { + $aux_info[_("Date of Payment")] = sql2date(get_oldest_payment_date($this->formData['trans_no'])); + $aux_info[_("Our Order No")] = $this->formData['order_']; + } else { + if ($this->formData['prepaid'] =='final') + $aux_info[_("Invoice Date")] = sql2date($this->formData['tran_date']); + else + $aux_info[_("Date of Sale")] = sql2date(get_oldest_delivery_date($this->formData['trans_no'])); + $aux_info[_("Due Date")] = sql2date($this->formData['due_date']); + } break; case ST_SUPPAYMENT: @@ -151,9 +175,10 @@ $Addr1['address'] = $this->formData['address']; $Addr2['title'] = _("Deliver To"); $Addr2['name'] = $this->company['coy_name']; - $Addr2['address'] = $this->formData['deliver_to']; + //$Addr2['address'] = $this->company['postal_address']; No, don't destroy delivery address! $this->formData['document_date'] = $this->formData['ord_date']; - $this->formData['document_number'] = $this->formData['order_no']; + $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + ? $this->formData['reference'] : $this->formData['order_no']; $aux_info = array( _("Customers Reference") => $this->formData['supp_account_no'], @@ -230,15 +255,6 @@ $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) ? $this->formData['reference'] : @$this->formData['trans_no']; - if (!isset($Payment_Terms)) - { - $id = $this->formData['payment_terms']; - $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator=".db_escape($id); - $result = db_query($sql,"could not get paymentterms"); - $row = db_fetch($result); - $Payment_Terms = _("Payment Terms") . ': ' . $row["terms"]; - } - // footer generic content if (@$this->formData['bank_name']) $Footer[] = _("Bank"). ": ".$this->formData['bank_name']. ", " . _("Bank Account") . ": " . $this->formData['bank_account_number']; @@ -267,5 +283,3 @@ foreach(explode("\n", $this->company['legal_text']) as $line) $Footer[] = $line; } - -?>