2.4.4 no Longer Displays 0.00 Sales Invoices in customer_inquiry.php. Fixed. $Braath...
[fa-stable.git] / sales / customer_invoice.php
index 6f38b64d718b9ef7f0472af845839c0287a8738f..e4ab5158322f95ef6fffea1a7f20fdf724a76317 100644 (file)
@@ -160,16 +160,15 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) )
        }
        else {
                $order_no = $_GET['InvoicePrepayments'];
-               $payments =  get_payments_for($_GET['InvoicePrepayments'], ST_SALESORDER);
        }
        processing_start();
 
-       $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
+       $_SESSION['Items'] = new cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
        $_SESSION['Items']->order_no = $order_no;
        $_SESSION['Items']->src_docs = array($order_no);
        $_SESSION['Items']->trans_no = 0;
        $_SESSION['Items']->trans_type = ST_SALESINVOICE;
-       $_SESSION['Items']->prepayments = $payments;
+
        $_SESSION['Items']->update_payments();
 
        copy_from_cart();
@@ -342,7 +341,7 @@ function check_data()
                        return false;
                }
        } else {
-               if (($_SESSION['Items']->payment_terms['days_before_due'] < 0) && !count($_SESSION['Items']->prepayments)) {
+               if (($_SESSION['Items']->payment_terms['days_before_due'] == -1) && !count($_SESSION['Items']->prepayments)) {
                        display_error(_("There is no non-invoiced payments for this order. If you want to issue final invoice, select delayed or cash payment terms."));
                        return false;
                }
@@ -355,6 +354,7 @@ function check_data()
 if (isset($_POST['process_invoice']) && check_data()) {
        $newinvoice=  $_SESSION['Items']->trans_no == 0;
        copy_to_cart();
+
        if ($newinvoice) 
                new_doc_date($_SESSION['Items']->document_date);