projects
/
fa-stable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9549235
)
A bug in Customer Allocations fixed.
author
Joe Hunt
<joe.hunt.consulting@gmail.com>
Fri, 13 Oct 2017 14:10:17 +0000
(16:10 +0200)
committer
Joe Hunt
<joe.hunt.consulting@gmail.com>
Fri, 13 Oct 2017 14:10:17 +0000
(16:10 +0200)
sales/allocations/customer_allocate.php
patch
|
blob
|
history
sales/allocations/customer_allocation_main.php
patch
|
blob
|
history
sales/includes/db/custalloc_db.inc
patch
|
blob
|
history
sales/inquiry/customer_allocation_inquiry.php
patch
|
blob
|
history
sales/inquiry/customer_inquiry.php
patch
|
blob
|
history
diff --git
a/sales/allocations/customer_allocate.php
b/sales/allocations/customer_allocate.php
index ab3a30013ab7cf11ea2c7d3dd960379d14e52321..8c051386dfe81bd5f3c340780d66f123c5b82447 100644
(file)
--- a/
sales/allocations/customer_allocate.php
+++ b/
sales/allocations/customer_allocate.php
@@
-46,7
+46,12
@@
function edit_allocations_for_transaction($type, $trans_no)
global $systypes_array;
$cart = $_SESSION['alloc'];
global $systypes_array;
$cart = $_SESSION['alloc'];
-
+
+ if ($cart->type == ST_JOURNAL && $cart->bank_amount < 0)
+ {
+ $cart->bank_amount = -$cart->bank_amount;
+ $cart->amount = -$cart->amount;
+ }
display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
display_heading($cart->person_name);
display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
display_heading($cart->person_name);
diff --git
a/sales/allocations/customer_allocation_main.php
b/sales/allocations/customer_allocation_main.php
index 5059735f6a9d8019d9992d488468e1e5d94e3273..56d4312f5fb1c2fa0a40f4679ade924faf5d8770 100644
(file)
--- a/
sales/allocations/customer_allocation_main.php
+++ b/
sales/allocations/customer_allocation_main.php
@@
-70,9
+70,14
@@
function alloc_link($row)
.$row["trans_no"] . "&trans_type=" . $row["type"]. "&debtor_no=" . $row["debtor_no"], ICON_ALLOC);
}
.$row["trans_no"] . "&trans_type=" . $row["type"]. "&debtor_no=" . $row["debtor_no"], ICON_ALLOC);
}
+function amount_total($row)
+{
+ return price_format($row['type'] == ST_JOURNAL && $row["Total"] < 0 ? -$row["Total"] : $row["Total"]);
+}
+
function amount_left($row)
{
function amount_left($row)
{
- return price_format(
$row["Total"]
-$row["alloc"]);
+ return price_format(
($row['type'] == ST_JOURNAL && $row["Total"] < 0 ? -$row["Total"] : $row["Total"])
-$row["alloc"]);
}
function check_settled($row)
}
function check_settled($row)
@@
-90,7
+95,7
@@
$cols = array(
_("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
_("Customer") => array('ord'=>''),
_("Currency") => array('align'=>'center'),
_("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'asc'),
_("Customer") => array('ord'=>''),
_("Currency") => array('align'=>'center'),
- _("Total") =>
'amount'
,
+ _("Total") =>
array('align'=>'right','fun'=>'amount_total')
,
_("Left to Allocate") => array('align'=>'right','insert'=>true, 'fun'=>'amount_left'),
array('insert'=>true, 'fun'=>'alloc_link')
);
_("Left to Allocate") => array('align'=>'right','insert'=>true, 'fun'=>'amount_left'),
array('insert'=>true, 'fun'=>'alloc_link')
);
diff --git
a/sales/includes/db/custalloc_db.inc
b/sales/includes/db/custalloc_db.inc
index 42eaff59536c7bdcd2f5ccf4c309ec65718b714d..ec7c3afbea4a45d4de7be743f8a8a2f9dcc7329e 100644
(file)
--- a/
sales/includes/db/custalloc_db.inc
+++ b/
sales/includes/db/custalloc_db.inc
@@
-119,8
+119,9
@@
function get_allocatable_from_cust_sql($customer_id=null, $settled)
.TB_PREF."debtor_trans as trans, "
.TB_PREF."debtors_master as debtor"
." WHERE trans.debtor_no=debtor.debtor_no
.TB_PREF."debtor_trans as trans, "
.TB_PREF."debtors_master as debtor"
." WHERE trans.debtor_no=debtor.debtor_no
- AND (((type=".ST_CUSTPAYMENT." OR type=".ST_BANKDEPOSIT.") AND (trans.ov_amount > 0))"
- ." OR ( (type=".ST_CUSTCREDIT. " OR type=".ST_JOURNAL. ") AND (ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)>0))";
+ AND (((type=".ST_CUSTPAYMENT." OR type=".ST_BANKDEPOSIT.") AND (trans.ov_amount > 0))
+ OR (type=".ST_CUSTCREDIT. " AND (ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)>0)
+ OR (type=".ST_JOURNAL. " AND (trans.ov_amount < 0)))";
if (!$settled)
$sql .= " AND (round(abs(ov_amount+ov_gst+ov_freight+ov_freight_tax-ov_discount-alloc),6) > 0)";
if (!$settled)
$sql .= " AND (round(abs(ov_amount+ov_gst+ov_freight+ov_freight_tax-ov_discount-alloc),6) > 0)";
@@
-216,7
+217,7
@@
function get_allocatable_to_cust_transactions($customer_id = null, $trans_no=nul
AND round(-IF(prep_amount, prep_amount, ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)-alloc,6) > 0
OR
trans.type = '". ST_JOURNAL."'
AND round(-IF(prep_amount, prep_amount, ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)-alloc,6) > 0
OR
trans.type = '". ST_JOURNAL."'
- AND ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount
<
0
+ AND ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount
>
0
OR
trans.type = '". ST_BANKPAYMENT."'
AND ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount>0
OR
trans.type = '". ST_BANKPAYMENT."'
AND ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount>0
diff --git
a/sales/inquiry/customer_allocation_inquiry.php
b/sales/inquiry/customer_allocation_inquiry.php
index 2bd2d58e38f94c1d648e87065280d04c84f539fc..5630f04d20facd74821acb5918f19a9266f9c6ff 100644
(file)
--- a/
sales/inquiry/customer_allocation_inquiry.php
+++ b/
sales/inquiry/customer_allocation_inquiry.php
@@
-87,7
+87,7
@@
function due_date($row)
function fmt_balance($row)
{
function fmt_balance($row)
{
- return
$row["TotalAmount"]
- $row["Allocated"];
+ return
($row["type"] == ST_JOURNAL && $row["TotalAmount"] < 0 ? -$row["TotalAmount"] : $row["TotalAmount"])
- $row["Allocated"];
}
function alloc_link($row)
}
function alloc_link($row)
diff --git
a/sales/inquiry/customer_inquiry.php
b/sales/inquiry/customer_inquiry.php
index e93f1d4319863dff4ae6beb2029a47da1f51c113..184e7e3b21eb395f20c54ff0f58c88d9413667f6 100644
(file)
--- a/
sales/inquiry/customer_inquiry.php
+++ b/
sales/inquiry/customer_inquiry.php
@@
-138,7
+138,7
@@
function gl_view($row)
function fmt_amount($row)
{
$value =
function fmt_amount($row)
{
$value =
- $row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT
|| $row['type']==ST_JOURNAL
?
+ $row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT ?
-$row["TotalAmount"] : $row["TotalAmount"];
return price_format($value);
}
-$row["TotalAmount"] : $row["TotalAmount"];
return price_format($value);
}