Fix receipt of cash fence must contains more legal information
This commit is contained in:
parent
fa4786a3f6
commit
27f803cab0
@ -93,10 +93,12 @@ class CashControl extends CommonObject
|
|||||||
'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'),
|
'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'),
|
||||||
'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'),
|
'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'),
|
||||||
'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'),
|
'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'),
|
||||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>490),
|
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
|
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
|
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
|
||||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510),
|
'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'userCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600),
|
||||||
|
'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602),
|
||||||
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700),
|
||||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
|
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -115,21 +117,24 @@ class CashControl extends CommonObject
|
|||||||
public $cheque;
|
public $cheque;
|
||||||
public $card;
|
public $card;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var integer|string $date_valid
|
|
||||||
*/
|
|
||||||
public $date_valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string date_creation
|
* @var integer|string date_creation
|
||||||
*/
|
*/
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
|
public $fk_user_creat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string $date_modification
|
* @var integer|string $date_modification
|
||||||
*/
|
*/
|
||||||
public $date_modification;
|
public $date_modification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer|string $date_valid
|
||||||
|
*/
|
||||||
|
public $date_valid;
|
||||||
|
public $fk_user_valid;
|
||||||
|
|
||||||
|
|
||||||
const STATUS_DRAFT = 0;
|
const STATUS_DRAFT = 0;
|
||||||
const STATUS_VALIDATED = 1;
|
const STATUS_VALIDATED = 1;
|
||||||
const STATUS_CLOSED = 1; // For the moment CLOSED = VALIDATED
|
const STATUS_CLOSED = 1; // For the moment CLOSED = VALIDATED
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/cashcontrol/report.php
|
* \file htdocs/compta/cashcontrol/report.php
|
||||||
* \ingroup cashdesk|takepos
|
* \ingroup cashdesk|takepos
|
||||||
* \brief List of bank transactions
|
* \brief List of sales from POS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOREQUIREMENU')) {
|
if (!defined('NOREQUIREMENU')) {
|
||||||
@ -36,6 +36,8 @@ if (!defined('NOBROWSERNOTIF')) {
|
|||||||
define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_GET['optioncss'] = "print";
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
@ -48,10 +50,8 @@ $langs->loadLangs(array("bills", "banks"));
|
|||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
|
|
||||||
$_GET['optioncss'] = "print";
|
$object = new CashControl($db);
|
||||||
|
$object->fetch($id);
|
||||||
$cashcontrol = new CashControl($db);
|
|
||||||
$cashcontrol->fetch($id);
|
|
||||||
|
|
||||||
//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
|
//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||||
$sortorder = 'ASC';
|
$sortorder = 'ASC';
|
||||||
@ -67,19 +67,19 @@ $arrayfields = array(
|
|||||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||||
);
|
);
|
||||||
|
|
||||||
$syear = $cashcontrol->year_close;
|
$syear = $object->year_close;
|
||||||
$smonth = $cashcontrol->month_close;
|
$smonth = $object->month_close;
|
||||||
$sday = $cashcontrol->day_close;
|
$sday = $object->day_close;
|
||||||
|
|
||||||
$posmodule = $cashcontrol->posmodule;
|
$posmodule = $object->posmodule;
|
||||||
$terminalid = $cashcontrol->posnumber;
|
$terminalid = $object->posnumber;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid > 0) { // Protection if external user
|
if ($user->socid > 0) { // Protection if external user
|
||||||
//$socid = $user->socid;
|
//$socid = $user->socid;
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
|
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON bu.url_id = f.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON bu.url_id = f.rowid";
|
||||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
// Define filter on invoice
|
// Define filter on invoice
|
||||||
$sql.= " AND f.module_source = '".$db->escape($cashcontrol->posmodule)."'";
|
$sql.= " AND f.module_source = '".$db->escape($object->posmodule)."'";
|
||||||
$sql.= " AND f.pos_source = '".$db->escape($cashcontrol->posnumber)."'";
|
$sql.= " AND f.pos_source = '".$db->escape($object->posnumber)."'";
|
||||||
$sql.= " AND f.entity IN (".getEntity('facture').")";
|
$sql.= " AND f.entity IN (".getEntity('facture').")";
|
||||||
// Define filter on data
|
// 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))."'";
|
if ($syear && ! $smonth) $sql.= " AND dateo BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
|
||||||
@ -151,19 +151,33 @@ if ($resql) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
print "<!-- title of cash fence -->\n";
|
print "<!-- title of cash fence -->\n";
|
||||||
print "<center><h2>";
|
print '<center>';
|
||||||
if ($cashcontrol->status != $cashcontrol::STATUS_DRAFT) {
|
print '<h2>';
|
||||||
print $langs->trans("CashControl")." ".$cashcontrol->id;
|
if ($object->status != $object::STATUS_DRAFT) {
|
||||||
|
print $langs->trans("CashControl")." ".$object->id;
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("CashControl")." - ".$langs->trans("Draft");
|
print $langs->trans("CashControl")." - ".$langs->trans("Draft");
|
||||||
}
|
}
|
||||||
print "<br>".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour');
|
print "</h2>";
|
||||||
print "</h2></center>";
|
print $langs->trans("DateCreationShort").": ".dol_print_date($object->date_creation, 'dayhour');
|
||||||
|
print '<br>'.$mysoc->name;
|
||||||
|
$userauthor = $object->fk_user_valid;
|
||||||
|
if (empty($userauthor)) {
|
||||||
|
$userauthor = $object->fk_user_creat;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uservalid = new User($db);
|
||||||
|
if ($userauthor > 0) {
|
||||||
|
$uservalid->fetch($userauthor);
|
||||||
|
print '<br>'.$langs->trans("Author").': '.$uservalid->getFullName($langs);
|
||||||
|
}
|
||||||
|
print '<br>'.$langs->trans("Period").': '.$object->year_close.($object->month_close ? '-'.$object->month_close : '').($object->day_close ? '-'.$object->day_close : '');
|
||||||
|
print '</center>';
|
||||||
|
|
||||||
$invoicetmp = new Facture($db);
|
$invoicetmp = new Facture($db);
|
||||||
|
|
||||||
print "<div style='text-align: right'><h2>";
|
print "<div style='text-align: right'><h2>";
|
||||||
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
|
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").' : <span class="amount">'.price($object->opening).'</span>';
|
||||||
print "</h2></div>";
|
print "</h2></div>";
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
@ -206,7 +220,7 @@ if ($resql) {
|
|||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
|
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
|
||||||
print '<td></td><td></td><td></td><td class="right"><span class="amount">'.price($cashcontrol->opening).'</span></td>';
|
print '<td></td><td></td><td></td><td class="right"><span class="amount">'.price($object->opening).'</span></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$first = "no";
|
$first = "no";
|
||||||
}*/
|
}*/
|
||||||
@ -232,8 +246,8 @@ 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 ($cashcontrol->posmodule == "takepos") {
|
if ($object->posmodule == "takepos") {
|
||||||
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
|
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$object->posnumber;
|
||||||
} else {
|
} else {
|
||||||
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
|
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
|
||||||
}
|
}
|
||||||
@ -305,48 +319,44 @@ if ($resql) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
//$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
|
//$cash = $amountpertype['LIQ'] + $object->opening;
|
||||||
$cash = price2num($cash + $cashcontrol->opening, 'MT');
|
$cash = price2num($cash + $object->opening, 'MT');
|
||||||
|
|
||||||
print '<div style="text-align: right"><h2>';
|
print '<div style="text-align: right">';
|
||||||
print $langs->trans("Cash").": ".price($cash);
|
print '<h2>';
|
||||||
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cash != $cashcontrol->cash) {
|
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cash).'</span>';
|
print $langs->trans("Cash").': <span class="amount">'.price($cash).'</span>';
|
||||||
|
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
|
||||||
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cash).'</span>';
|
||||||
}
|
}
|
||||||
print "<br><br>";
|
print "<br>";
|
||||||
|
|
||||||
//print '<br>';
|
//print '<br>';
|
||||||
print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
|
print $langs->trans("PaymentTypeCHQ").': <span class="amount">'.price($cheque).'</span>';
|
||||||
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cheque != $cashcontrol->cheque) {
|
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cheque).'</span>';
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cheque).'</span>';
|
||||||
}
|
}
|
||||||
print "<br><br>";
|
print "<br>";
|
||||||
|
|
||||||
//print '<br>';
|
//print '<br>';
|
||||||
print $langs->trans("PaymentTypeCB").": ".price($bank);
|
print $langs->trans("PaymentTypeCB").': <span class="amount">'.price($bank).'</span>';
|
||||||
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $bank != $cashcontrol->card) {
|
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
|
||||||
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->card).'</span>';
|
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->card).'</span>';
|
||||||
}
|
}
|
||||||
print "<br><br>";
|
print "<br>";
|
||||||
|
|
||||||
// print '<br>';
|
// print '<br>';
|
||||||
if ($other) {
|
if ($other) {
|
||||||
print '<br>'.$langs->trans("Other").": ".price($other)."<br><br>";
|
print ''.$langs->trans("Other").': <span class="amount">'.price($other)."</span>";
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
print "</h2></div>";
|
|
||||||
|
|
||||||
//save totals to DB
|
print $langs->trans("Total").': <span class="amount">'.price($cash + $cheque + $bank + $other).'</span>';
|
||||||
/*
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence ";
|
|
||||||
$sql .= "SET";
|
|
||||||
$sql .= " cash='".$db->escape($cash)."'";
|
|
||||||
$sql .= ", card='".$db->escape($bank)."'";
|
|
||||||
$sql .= " where rowid = ".((int) $id);
|
|
||||||
$db->query($sql);
|
|
||||||
*/
|
|
||||||
|
|
||||||
print "</div>";
|
print '</h2>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user