diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index c240495c4a2..0a7e2fa2d17 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -256,7 +256,7 @@ if ($action == "create" || $action == "start") $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))."'"; + 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); @@ -296,7 +296,7 @@ if ($action == "create" || $action == "start") } 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))."'"; + 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); @@ -330,7 +330,7 @@ if ($action == "create" || $action == "start") print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -343,7 +343,11 @@ if ($action == "create" || $action == "start") print ''; print ''; print '
'.$langs->trans("Module").''.$langs->trans("CashDesk").' ID'.$langs->trans("Terminal").''.$langs->trans("Year").''.$langs->trans("Month").''.$langs->trans("Day").'
'.$form->selectarray('posmodule', $arrayofposavailable, GETPOST('posmodule', 'alpha'), (count($arrayofposavailable) > 1 ? 1 : 0)).''; - $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6", 7=>"7", 8=>"8", 9=>"9"); + + $array = array(); + for($i = 1; $i <= max(1, $conf->global->TAKEPOS_NUM_TERMINALS); $i++) { + $array[$i] = $i; + } $selectedposnumber = 0; $showempty = 1; if ($conf->global->TAKEPOS_NUM_TERMINALS == '1') { @@ -502,92 +506,97 @@ if ($action == "create" || $action == "start") if (empty($action) || $action == "view") { - $object->fetch($id); + $result = $object->fetch($id); llxHeader('', $langs->trans("CashControl")); - $head = array(); - $head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id; - $head[0][1] = $langs->trans("Card"); - $head[0][2] = 'cashcontrol'; - - dol_fiche_head($head, 'cashcontrol', $langs->trans("CashControl"), -1, 'cashcontrol'); - - $linkback = ''.$langs->trans("BackToList").''; - - $morehtmlref = '
'; - $morehtmlref .= '
'; - - - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); - - print '
'; - print '
'; - print '
'; - print ''; - - print ''; - - print '"; - - print '"; - - print ''; - - print '
'; - print $langs->trans("Ref"); - print ''; - print $id; - print '
'.$langs->trans("Module").''; - print $object->posmodule; - print "
'.$langs->trans("CashDesk").' ID'; - print $object->posnumber; - print "
'; - print $langs->trans("Period"); - print ''; - print $object->year_close."-".$object->month_close."-".$object->day_close; - print '
'; - print '
'; - - print '
'; - print '
'; - print ''; - - print ''; - - print '"; - - foreach ($arrayofpaymentmode as $key => $val) - { - print '"; + if ($result <= 0) { + print $langs->trans("ErrorRecordNotFound"); } + else { + $head = array(); + $head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id; + $head[0][1] = $langs->trans("Card"); + $head[0][2] = 'cashcontrol'; - print "
'; - print $langs->trans("DateCreationShort"); - print ''; - print dol_print_date($object->date_creation, 'dayhour'); - print '
'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").''; - print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency); - print "
'.$langs->trans($val).''; - print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency); - print "
\n"; - print '
'; - print '
'; - print '
'; + dol_fiche_head($head, 'cashcontrol', $langs->trans("CashControl"), -1, 'cashcontrol'); - dol_fiche_end(); + $linkback = ''.$langs->trans("BackToList").''; - print '
'; - print ''; - if ($object->status == CashControl::STATUS_DRAFT) - { - print ''; + $morehtmlref = '
'; + $morehtmlref .= '
'; - print ''; - } - print '
'; - print '
'; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); + + print '
'; + print '
'; + print '
'; + print ''; + + print ''; + + print '"; + + print '"; + + print ''; + + print '
'; + print $langs->trans("Ref"); + print ''; + print $id; + print '
'.$langs->trans("Module").''; + print $object->posmodule; + print "
'.$langs->trans("CashDesk").' ID'; + print $object->posnumber; + print "
'; + print $langs->trans("Period"); + print ''; + print $object->year_close."-".$object->month_close."-".$object->day_close; + print '
'; + print '
'; + + print '
'; + print '
'; + print ''; + + print ''; + + print '"; + + foreach ($arrayofpaymentmode as $key => $val) + { + print '"; + } + + print "
'; + print $langs->trans("DateCreationShort"); + print ''; + print dol_print_date($object->date_creation, 'dayhour'); + print '
'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").''; + print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency); + print "
'.$langs->trans($val).''; + print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency); + print "
\n"; + print '
'; + print '
'; + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + if ($object->status == CashControl::STATUS_DRAFT) + { + print ''; + + print ''; + } + print '
'; + + print '
'; + } } // End of page