- if ($order->trans_type == ST_SALESINVOICE && $order->pos != -1) {
- sale_payment_list_cells(_('Payment:'), 'cash', null, true);
- $cash_payment = get_post('cash', 0);
- // current user can issue both credit and cash invoices
- if ($order->cash != $cash_payment) {
- $order->cash = $cash_payment;
- if ($cash_payment) {
- $paym = get_sales_point(user_pos());
- $order->cash_account = $paym['pos_account'];
- $order->account_name = $paym['bank_account_name'];
- $_POST['Location'] = $order->Location = $paym['pos_location'];
- $order->location_name = $paym['location_name'];
+ customer_credit_row($_POST['customer_id'], $order->credit);
+
+ label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%");
+
+ table_section(3);
+ if ($order->pos['cash_sale'] || $order->pos['credit_sale']) {
+ // editable payment type
+ if (get_post('payment') !== $order->payment) {
+ $order->payment = get_post('payment');
+ $order->payment_terms = get_payment_terms($order->payment);
+ $order->due_date = get_invoice_duedate($order->payment, $order->document_date);
+ if ($order->payment_terms['cash_sale']) {
+ $order->cash_account = $order->pos['pos_account'];
+ $order->account_name = $order->pos['bank_account_name'];
+ $_POST['Location'] = $order->Location = $order->pos['pos_location'];
+ $order->location_name = $order->pos['location_name'];