Release 2.3.25.
[fa-stable.git] / sales / customer_payments.php
index 1f60e058068e745caccce1e6099f48a0690e033f..e32f5a8f58ab1e181eed4df3bc098eaa068a983d 100644 (file)
@@ -49,18 +49,19 @@ if (!isset($_POST['bank_account'])) { // first page call
        if (isset($_GET['SInvoice'])) {
                //  get date and supplier
                $inv = get_customer_trans($_GET['SInvoice'], ST_SALESINVOICE);
+               $dflt_act = get_default_bank_account($inv['curr_code']);
+               $_POST['bank_account'] = $dflt_act['id'];
                if($inv) {
-                       $_POST['customer_id'] = $inv['debtor_no'];
+                       $_SESSION['alloc']->person_id = $_POST['customer_id'] = $inv['debtor_no'];
+                       $_SESSION['alloc']->read();
                        $_POST['DateBanked'] = sql2date($inv['tran_date']);
                        foreach($_SESSION['alloc']->allocs as $line => $trans) {
                                if ($trans->type == ST_SALESINVOICE && $trans->type_no == $_GET['SInvoice']) {
                                        $un_allocated = $trans->amount - $trans->amount_allocated;
-                                       if($un_allocated){
-                                       $_POST['amount'] = $_SESSION['alloc']->amount = 
-//                                             price_format($trans->amount);
-                                       $_SESSION['alloc']->allocs[$line]->current_allocated =
-//                                             $trans->amount;
-                                               price_format($un_allocated);}
+                                       if ($un_allocated){
+                                               $_SESSION['alloc']->allocs[$line]->current_allocated = $un_allocated;
+                                               $_POST['amount'] = $_POST['amount'.$line] = price_format($un_allocated);
+                                       }
                                        break;
                                }
                        }
@@ -327,7 +328,7 @@ start_form();
        hidden('trans_no');
        hidden('old_ref', $old_ref);
 
-       start_outer_table(TABLESTYLE2, "width=60%", 5);
+       start_outer_table(TABLESTYLE2, "width='60%'", 5);
 
        table_section(1);
 
@@ -387,7 +388,7 @@ start_form();
        show_allocatable(false);
        div_end();
 
-       start_table(TABLESTYLE, "width=60%");
+       start_table(TABLESTYLE, "width='60%'");
 
        label_row(_("Customer prompt payment discount :"), $display_discount_percent);