Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
ae6596cac7
@ -121,7 +121,7 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1',1,0,1,array(),0);
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1', 1, 0, 0, array(), 0);
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
@ -157,7 +157,8 @@ if (! empty($conf->stock->enabled))
|
||||
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
|
||||
$res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch');
|
||||
print $langs->trans("Yes").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -173,7 +174,7 @@ if (! empty($conf->stock->enabled))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("StockDecreaseForPointOfSaleDisabled");
|
||||
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use Stripe\BankAccount;
|
||||
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@ -28,6 +30,7 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
|
||||
$langs->loadLangs(array("cashcontrol","install","cashdesk","admin","banks"));
|
||||
@ -38,7 +41,10 @@ $action=GETPOST('action','aZ09');
|
||||
$categid = GETPOST('categid');
|
||||
$label = GETPOST("label");
|
||||
|
||||
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) or empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB)) setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors');
|
||||
$now=dol_now();
|
||||
$syear = (GETPOSTISSET('closeyear')?GETPOST('closeyear', 'int'):dol_print_date($now, "%Y"));
|
||||
$smonth = (GETPOSTISSET('closemonth')?GETPOST('closemonth', 'int'):dol_print_date($now, "%m"));
|
||||
$sday = (GETPOSTISSET('closeday')?GETPOST('closeday', 'int'):dol_print_date($now, "%d"));
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -78,6 +84,16 @@ $hookmanager->initHooks(array('cashcontrolcard','globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
|
||||
{
|
||||
setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('cancel'))
|
||||
{
|
||||
$action = 'create';
|
||||
}
|
||||
if ($action=="start")
|
||||
{
|
||||
$error=0;
|
||||
@ -102,13 +118,13 @@ if ($action=="start")
|
||||
}
|
||||
elseif ($action=="add")
|
||||
{
|
||||
$error=0;
|
||||
if (GETPOST('opening','alpha') == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InitialBankBalance")), null, 'errors');
|
||||
$action='start';
|
||||
$error++;
|
||||
}
|
||||
$error=0;
|
||||
foreach($arrayofpaymentmode as $key=>$val)
|
||||
{
|
||||
if (GETPOST($key,'alpha') == '')
|
||||
@ -133,9 +149,20 @@ elseif ($action=="add")
|
||||
$object->posmodule=GETPOST('posmodule','alpha');
|
||||
$object->posnumber=GETPOST('posnumber','alpha');
|
||||
|
||||
$id=$object->create($user);
|
||||
$db->begin();
|
||||
|
||||
$action="view";
|
||||
$id=$object->create($user);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$db->commit();
|
||||
$action="view";
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback;
|
||||
$action="view";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,16 +198,86 @@ if ($action=="create" || $action=="start")
|
||||
$initialbalanceforterminal=array();
|
||||
$theoricalamountforterminal=array();
|
||||
|
||||
if (GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1')
|
||||
if (GETPOST('posnumber','alpha') != '' && GETPOST('posnumber','alpha') != '' && GETPOST('posnumber','alpha') != '-1')
|
||||
{
|
||||
// Calculate $initialbalanceforterminal and $theoricalamountforterminal for terminal 0
|
||||
// TODO
|
||||
$posmodule = GETPOST('posmodule','alpha');
|
||||
$terminalid = GETPOST('posnumber','alpha');
|
||||
|
||||
// Calculate $initialbalanceforterminal for terminal 0
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
if ($key != 'cash')
|
||||
{
|
||||
$initialbalanceforterminal[$terminalid][$key] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the bank account dedicated to this point of sale module/terminal
|
||||
$bankid = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
|
||||
// Hook to get the good bank id according to posmodule and posnumber.
|
||||
// @TODO add hook here
|
||||
|
||||
$sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account = ".$bankid;
|
||||
if ($syear && ! $smonth) $sql.= " AND dateo < '".$db->idate(dol_get_first_day($syear, 1))."'";
|
||||
elseif ($syear && $smonth && ! $sday) $sql.= " AND dateo < '".$db->idate(dol_get_first_day($syear, $smonth))."'";
|
||||
elseif ($syear && $smonth && $sday) $sql.= " AND dateo < '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."'";
|
||||
else dol_print_error('', 'Year not defined');
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $initialbalanceforterminal[$terminalid][$key] = $obj->total;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
// Calculate $theoricalamountforterminal for terminal 0
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
/*$sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account = ".$bankid;*/
|
||||
|
||||
$sql = "SELECT SUM(pf.amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp";
|
||||
$sql.= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement";
|
||||
$sql.= " AND f.module_source = '".$db->escape($posmodule)."'";
|
||||
$sql.= " AND f.pos_source = '".$db->escape($terminalid)."'";
|
||||
$sql.= " AND f.paye = 1";
|
||||
$sql.= " AND p.entity IN (".getEntity('facture').")";
|
||||
if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
|
||||
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
|
||||
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
|
||||
else
|
||||
{
|
||||
dol_print_error('Value for key = '.$key.' not supported');
|
||||
exit;
|
||||
}
|
||||
if ($syear && ! $smonth) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
|
||||
elseif ($syear && $smonth && ! $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'";
|
||||
elseif ($syear && $smonth && $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
|
||||
else dol_print_error('', 'Year not defined');
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$theoricalamountforterminal[$terminalid][$key] = $initialbalanceforterminal[$terminalid][$key];
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$theoricalamountforterminal[$terminalid][$key] = price2num($theoricalamountforterminal[$terminalid][$key] + $obj->total);
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'title_bank.png');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($action == 'start' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1')
|
||||
if ($action == 'start' && GETPOST('posnumber','int') != '' && GETPOST('posnumber','int') != '' && GETPOST('posnumber','int') != '-1')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
}
|
||||
@ -198,10 +295,6 @@ if ($action=="create" || $action=="start")
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$now=dol_now();
|
||||
$syear = (GETPOSTISSET('closeyear')?GETPOST('closeyear', 'int'):dol_print_date($now, "%Y"));
|
||||
$smonth = (GETPOSTISSET('closemonth')?GETPOST('closemonth', 'int'):dol_print_date($now, "%m"));
|
||||
$sday = (GETPOSTISSET('closeday')?GETPOST('closeday', 'int'):dol_print_date($now, "%d"));
|
||||
$disabled=0;
|
||||
$prefix='close';
|
||||
|
||||
@ -242,6 +335,7 @@ if ($action=="create" || $action=="start")
|
||||
$retstring.="</select>";
|
||||
print $retstring;
|
||||
print '</td>';
|
||||
// Button Start
|
||||
print '<td>';
|
||||
if ($action == 'start' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1')
|
||||
{
|
||||
@ -256,28 +350,81 @@ if ($action=="create" || $action=="start")
|
||||
|
||||
if ($action == 'start' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1')
|
||||
{
|
||||
$posmodule = GETPOST('posmodule','alpha');
|
||||
$terminalid = GETPOST('posnumber','alpha');
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td align="center">'.$langs->trans("InitialBankBalance");
|
||||
//print '<br>'.$langs->trans("TheoricalAmount").'<br>'.$langs->trans("RealAmount");
|
||||
print '</td>';
|
||||
print '<td align="center" class="hide0" colspan="'.count($arrayofpaymentmode).'">';
|
||||
print $langs->trans("AmountAtEndOfPeriod");
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td></td>';
|
||||
print '<td align="center">'.$langs->trans("Cash");
|
||||
//print '<br>'.$langs->trans("TheoricalAmount").'<br>'.$langs->trans("RealAmount");
|
||||
print '</td>';
|
||||
$i=0;
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans($val).'<br>'.$langs->trans("TheoricalAmount").'<br>'.$langs->trans("RealAmount").'</td>';
|
||||
print '<td align="center"'.($i == 0 ? ' class="hide0"':'').'>'.$langs->trans($val);
|
||||
//print '<br>'.$langs->trans("TheoricalAmount").'<br>'.$langs->trans("RealAmount");
|
||||
print '</td>';
|
||||
$i++;
|
||||
}
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
// Initial amount
|
||||
print '<td align="center"><input name="opening" type="text" class="maxwidth100" value="'.price($initialbalanceforterminal[0]).'"></td>';
|
||||
print '<td>'.$langs->trans("TheoricalAmount").'</td>';
|
||||
print '<td align="center">';
|
||||
print price($initialbalanceforterminal[$terminalid]['cash']).'<br>';
|
||||
print '</td>';
|
||||
// Amount per payment type
|
||||
$i=0;
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print price($theoricalamountforterminal[0][$key]).'<br>';
|
||||
print '<input name="'.$key.'" type="text" class="maxwidth100" value="'.GETPOST($key,'alpha').'">';
|
||||
print '<td align="center"'.($i == 0 ? ' class="hide0"':'').'>';
|
||||
print price($theoricalamountforterminal[$terminalid][$key]).'<br>';
|
||||
print '</td>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<td align="center"><input type="submit" name="add" class="button" value="'.$langs->trans("Save").'"></td>';
|
||||
// Save
|
||||
print '<td align="center"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("RealAmount").'</td>';
|
||||
// Initial amount
|
||||
print '<td align="center">';
|
||||
print '<input name="opening" type="text" class="maxwidth100 center" value="'.(GETPOSTISSET('opening')?price2num(GETPOST('opening','alpha')):price($initialbalanceforterminal[$terminalid]['cash'])).'">';
|
||||
print '</td>';
|
||||
// Amount per payment type
|
||||
$i=0;
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
{
|
||||
print '<td align="center"'.($i == 0 ? ' class="hide0"':'').'>';
|
||||
print '<input name="'.$key.'" type="text"'.($key == 'cash'?' autofocus':'').' class="maxwidth100 center" value="'.GETPOST($key,'alpha').'">';
|
||||
print '</td>';
|
||||
$i++;
|
||||
}
|
||||
// Save
|
||||
print '<td align="center">';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" name="add" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</form>';
|
||||
@ -342,7 +489,7 @@ if (empty($action) || $action=="view")
|
||||
print dol_print_date($object->date_creation, 'dayhour');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").'</td><td>';
|
||||
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
|
||||
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class CashControl extends CommonObject
|
||||
/**
|
||||
* @var string String with name of icon for pos_cash_fence. Must be the part after the 'object_' into object_pos_cash_fence.png
|
||||
*/
|
||||
public $picto = 'bank';
|
||||
public $picto = 'account';
|
||||
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>10),
|
||||
@ -141,7 +141,7 @@ class CashControl extends CommonObject
|
||||
$sql .= ") VALUES (";
|
||||
//$sql .= "'(PROV)', ";
|
||||
$sql .= $conf->entity;
|
||||
$sql .= ", ".($this->opening > 0 ? $this->opening : 0);
|
||||
$sql .= ", ".(is_numeric($this->opening) ? $this->opening : 0);
|
||||
$sql .= ", 0"; // Draft by default
|
||||
$sql .= ", '".$this->db->idate(dol_now())."'";
|
||||
$sql .= ", '".$this->db->escape($this->posmodule)."'";
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/bankentries_list.php
|
||||
* \file htdocs/compta/cashcontrol/report.php
|
||||
* \ingroup pos
|
||||
* \brief List of bank transactions
|
||||
*/
|
||||
@ -53,34 +53,67 @@ $arrayfields=array(
|
||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||
);
|
||||
|
||||
$syear = $cashcontrol->year_close;
|
||||
$smonth = $cashcontrol->month_close;
|
||||
$sday = $cashcontrol->day_close;
|
||||
|
||||
$posmodule = $cashcontrol->posmodule;
|
||||
$terminalid = $cashcontrol->posnumber;
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("CashControl"), '', '', 0, 0, array(), array(), $param);
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
|
||||
/*$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
|
||||
$sql.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$sql.= " bu.url_id,";
|
||||
$sql.= " f.module_source, f.facnumber as facnumber";
|
||||
$sql.= " FROM ";
|
||||
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
//if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'payment'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON bu.url_id = f.rowid";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND f.module_source='$cashcontrol->posmodule'";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
|
||||
$sql.=" AND b.datec>'".$cashcontrol->date_creation."'";
|
||||
if ($cashcontrol->date_close>0) $sql.=" AND b.datec<'".$cashcontrol->date_close."'";
|
||||
$sql.=" AND (b.fk_account=";
|
||||
$sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
|
||||
$sql.=" or b.fk_account=";
|
||||
$sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CB;
|
||||
// Define filter on invoice
|
||||
$sql.= " AND f.module_source = '".$db->escape($cashcontrol->posmodule)."'";
|
||||
$sql.= " AND f.pos_source = '".$db->escape($cashcontrol->posnumber)."'";
|
||||
$sql.= " AND f.entity IN (".getEntity('facture').")";
|
||||
// Define filter on data
|
||||
if ($syear && ! $smonth) $sql.= " AND dateo BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
|
||||
elseif ($syear && $smonth && ! $sday) $sql.= " AND dateo BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'";
|
||||
elseif ($syear && $smonth && $sday) $sql.= " AND dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
|
||||
else dol_print_error('', 'Year not defined');
|
||||
// Define filter on bank account
|
||||
$sql.=" AND (b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
|
||||
$sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CB;
|
||||
$sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
|
||||
$sql.=")";
|
||||
*/
|
||||
$sql = "SELECT f.facnumber, pf.amount as total, cp.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp";
|
||||
$sql.= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement";
|
||||
$sql.= " AND f.module_source = '".$db->escape($posmodule)."'";
|
||||
$sql.= " AND f.pos_source = '".$db->escape($terminalid)."'";
|
||||
$sql.= " AND f.paye = 1";
|
||||
$sql.= " AND p.entity IN (".getEntity('facture').")";
|
||||
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
|
||||
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
|
||||
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
|
||||
else
|
||||
{
|
||||
dol_print_error('Value for key = '.$key.' not supported');
|
||||
exit;
|
||||
}*/
|
||||
if ($syear && ! $smonth) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
|
||||
elseif ($syear && $smonth && ! $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_get_first_day($syear, $smonth))."' AND '".$db->idate(dol_get_last_day($syear, $smonth))."'";
|
||||
elseif ($syear && $smonth && $sday) $sql.= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
|
||||
else dol_print_error('', 'Year not defined');
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -90,7 +123,7 @@ if ($resql)
|
||||
print "<center><h2>";
|
||||
if ($cashcontrol->status==2) print $langs->trans("CashControl")." ".$cashcontrol->id;
|
||||
else print $langs->trans("CashControl")." - ".$langs->trans("Draft");
|
||||
print "<br>".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'day')."</h2></center>";
|
||||
print "<br>".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour')."</h2></center>";
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
@ -111,6 +144,7 @@ if ($resql)
|
||||
|
||||
// Loop on each record
|
||||
$sign = 1;
|
||||
$first='yes';
|
||||
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
@ -149,40 +183,6 @@ if ($resql)
|
||||
else dol_print_error($db);
|
||||
|
||||
$balancecalculated=true;
|
||||
|
||||
// Output a line with start balance
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile')
|
||||
{
|
||||
$tmpnbfieldbeforebalance=0;
|
||||
$tmpnbfieldafterbalance=0;
|
||||
$balancefieldfound=false;
|
||||
foreach($arrayfields as $key => $val)
|
||||
{
|
||||
if ($key == 'balancebefore' || $key == 'balance')
|
||||
{
|
||||
$balancefieldfound=true;
|
||||
continue;
|
||||
}
|
||||
if (! empty($arrayfields[$key]['checked']))
|
||||
{
|
||||
if (! $balancefieldfound) $tmpnbfieldbeforebalance++;
|
||||
else $tmpnbfieldafterbalance++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven trforbreak">';
|
||||
if ($tmpnbfieldbeforebalance)
|
||||
{
|
||||
print '<td colspan="'.$tmpnbfieldbeforebalance.'">';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">';
|
||||
print price(price2num($balance, 'MT'), 1, $langs);
|
||||
print '</td>';
|
||||
print '<td colspan="'.($tmpnbfieldafterbalance+3).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$balance = price2num($balance + ($sign * $objp->amount),'MT');
|
||||
@ -200,13 +200,18 @@ if ($resql)
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if ($first==""){
|
||||
print '<td>'.$langs->trans("InitialBankBalance").'</td><td></td><td></td><td></td><td align="right">'.price($cashcontrol->opening).'</td></tr>';
|
||||
if ($first == "yes")
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
$first="no";
|
||||
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
|
||||
print '<td></td><td></td><td></td><td align="right">'.price($cashcontrol->opening).'</td>';
|
||||
print '</tr>';
|
||||
$first = "no";
|
||||
}
|
||||
|
||||
// Ref
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td align="left" class="nowrap">';
|
||||
print $objp->facnumber;
|
||||
print '</td>';
|
||||
@ -222,8 +227,9 @@ if ($resql)
|
||||
// Bank account
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->rowid) $cash+=$objp->amount;
|
||||
if ($sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->rowid) $bank+=$objp->amount;
|
||||
if ($sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
|
||||
if ($sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
|
||||
if ($sql.=$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
@ -277,16 +283,21 @@ if ($resql)
|
||||
print "</table>";
|
||||
|
||||
$cash=$cash+$cashcontrol->opening;
|
||||
print "<div style='text-align: right'><h2>".$langs->trans("Cash").": ".price($cash)."<br><br>".$langs->trans("PaymentTypeCB").": ".price($bank)."</h2></div>";
|
||||
|
||||
print "<div style='text-align: right'><h2>";
|
||||
print $langs->trans("Cash").": ".price($cash)."<br><br>";
|
||||
print $langs->trans("PaymentTypeCB").": ".price($bank)."<br><br>";
|
||||
print $langs->trans("PaymentTypeCheque").": ".price($cheque)."<br><br>";
|
||||
print "</h2></div>";
|
||||
|
||||
//save totals to DB
|
||||
/*
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence ";
|
||||
$sql .= "SET";
|
||||
$sql .= " cash='".$cash."'";
|
||||
$sql .= ", card='".$bank."'";
|
||||
$sql .= " where rowid=".$id;
|
||||
$db->query($sql);
|
||||
*/
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -42,3 +42,4 @@ Place=Place
|
||||
TakeposConnectorNecesary='TakePOS Connector' required
|
||||
OrderPrinters=Order printers
|
||||
SearchProduct=Search product
|
||||
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
|
||||
@ -388,7 +388,7 @@ $head=project_timesheet_prepare_head($mode, $usertoprocess);
|
||||
dol_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, 'task');
|
||||
|
||||
// Show description of content
|
||||
print '<div class="hideonsmartphone">';
|
||||
print '<div class="hideonsmartphone opacitymedium">';
|
||||
if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else
|
||||
{
|
||||
|
||||
@ -390,7 +390,7 @@ $head=project_timesheet_prepare_head($mode, $usertoprocess);
|
||||
dol_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, 'task');
|
||||
|
||||
// Show description of content
|
||||
print '<div class="hideonsmartphone">';
|
||||
print '<div class="hideonsmartphone opacitymedium">';
|
||||
if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1',1,0,1,array(),0);
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', 1, 0, 0, array(), 0);
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
@ -188,7 +188,8 @@ if (! empty($conf->stock->enabled))
|
||||
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
|
||||
$res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch');
|
||||
print $langs->trans("Yes").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -204,7 +205,7 @@ if (! empty($conf->stock->enabled))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("StockDecreaseForPointOfSaleDisabled");
|
||||
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user