Cashcontrol TakePOS fixes

This commit is contained in:
andreubisquerra 2019-08-18 09:33:02 +02:00
parent 40f5bbc4bb
commit 063f19fe67
2 changed files with 15 additions and 16 deletions

View File

@ -88,7 +88,7 @@ if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcon
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1); $backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH)) if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH1))
{ {
setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors'); setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors');
} }
@ -132,16 +132,7 @@ elseif ($action=="add")
$error=0; $error=0;
foreach($arrayofpaymentmode as $key=>$val) foreach($arrayofpaymentmode as $key=>$val)
{ {
if (GETPOST($key.'_amount', 'alpha') == '') $object->$key = price2num(GETPOST($key.'_amount', 'alpha'));
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
$action='start';
$error++;
}
else
{
$object->$key = price2num(GETPOST($key.'_amount', 'alpha'));
}
} }
if (! $error) if (! $error)
@ -235,7 +226,7 @@ if ($action=="create" || $action=="start")
$posmodule = GETPOST('posmodule', 'alpha'); $posmodule = GETPOST('posmodule', 'alpha');
$terminalid = GETPOST('posnumber', 'alpha'); $terminalid = GETPOST('posnumber', 'alpha');
$terminaltouse = $terminalid; $terminaltouse = $terminalid;
if ($terminaltouse == '1') $terminaltouse = ''; if ($terminaltouse == '1' && $posmodule=='cashdesk') $terminaltouse = '';
// Calculate $initialbalanceforterminal for terminal 0 // Calculate $initialbalanceforterminal for terminal 0
foreach($arrayofpaymentmode as $key => $val) foreach($arrayofpaymentmode as $key => $val)

View File

@ -196,10 +196,18 @@ if ($resql)
// Bank account // Bank account
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print $bankaccount->getNomUrl(1); print $bankaccount->getNomUrl(1);
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount; if ($cashcontrol->posmodule=="takepos"){
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount; if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount; elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
else $other+=$objp->amount; elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
}
else{
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
}
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;