diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 955a33d1e5d..ffb610747db 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -387,19 +387,19 @@ if ($socid > 0) if ($conf->propal->enabled && $user->rights->propale->lire) { $propal_static = new Propal($db); - + $proposals = $propal_static->liste_array(0, 0, 0, $objsoc->id, $MAXLIST); - + //var_dump($proposals); print ''; $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; - $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; - $sql .= " AND s.rowid = ".$objsoc->id; - $sql .= " ORDER BY p.datep DESC"; + $sql.= " p.datep as dp, p.fin_validite as datelimite"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; + $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; + $sql.= " AND s.rowid = ".$objsoc->id; + $sql.= " ORDER BY p.datep DESC"; $resql=$db->query($sql); if ($resql) @@ -419,11 +419,11 @@ if ($socid > 0) $objp = $db->fetch_object($resql); print ""; print "\n"; + print '\n"; print ''; print ''; $var=!$var; @@ -449,7 +449,7 @@ if ($socid > 0) $sql = "SELECT s.nom, s.rowid,"; $sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; - $sql.= " ".$db->pdate("c.date_commande")." as dc"; + $sql.= " c.date_commande as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND s.rowid = ".$objsoc->id; @@ -473,7 +473,7 @@ if ($socid > 0) $var=!$var; print ""; print '\n"; + print '\n"; print ''; print ''; $i++; @@ -496,7 +496,7 @@ if ($socid > 0) print '
propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; - if ( ($objp->dp < $now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); } - print ''.dol_print_date($objp->dp,'day')."'.dol_print_date($db->jdate($objp->dp),'day')."'.price($objp->total_ht).''.$propal_static->LibStatut($objp->fk_statut,5).'
'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; - print ''.dol_print_date($objp->dc,'day')."'.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'
'; - $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, ".$db->pdate("c.datec")." as dc"; + $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= " WHERE c.fk_soc = s.rowid "; $sql .= " AND s.rowid = ".$objsoc->id; @@ -527,7 +527,7 @@ if ($socid > 0) $contrat->ref=$objp->ref?$objp->ref:$objp->id; print $contrat->getNomUrl(1,12); print "\n"; - print '\n"; + print '\n"; print ''; print ''; + print ''; + print '
'.dol_print_date($objp->dc,'day')."'.dol_print_date($db->jdate($objp->dc),'day')." '; $contrat->fetch_lignes(); @@ -552,7 +552,7 @@ if ($socid > 0) { print ''; - $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, ".$db->pdate("f.datei")." as di"; + $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.datei as di"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND s.rowid = ".$objsoc->id; @@ -576,7 +576,7 @@ if ($socid > 0) $objp = $db->fetch_object($resql); print ""; print ''."\n"; + print ''."\n"; print ''; $var=!$var; $i++; @@ -598,7 +598,7 @@ if ($socid > 0) { print '
'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; - print ''.dol_print_date($objp->di,"day").''.dol_print_date($db->jdate($objp->di),"day").'
'; - $sql = "SELECT p.rowid,p.title,p.ref,p.public,".$db->pdate("p.dateo")." as do"; + $sql = "SELECT p.rowid,p.title,p.ref,p.public, p.dateo as do"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " WHERE p.fk_soc = $objsoc->id"; $sql .= " ORDER BY p.dateo DESC"; @@ -637,7 +637,7 @@ if ($socid > 0) // Label print ''; // Date - print ''; + print ''; print ''; } @@ -669,19 +669,21 @@ if ($socid > 0) //$num = sizeOf($result); $num=$chronodocs_static->get_nb_chronodocs($objsoc->id); - if ($num > 0) { + if ($num > 0) + { print ''; print ''; print ''; } - while ($i < $num && $i < $MAXLIST) { + while ($i < $num && $i < $MAXLIST) + { $obj = array_shift($result); $var = !$var; print ""; print ''; print ""; - print "\n"; + print "\n"; print ""; $i++; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 7022e42aea4..c482c20c0e1 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -277,7 +277,7 @@ $max=3; if ($conf->propal->enabled && $user->rights->propale->lire) { - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total_ht, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total_ht, p.ref, p.fk_statut, p.datep as dp"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -407,7 +407,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) { $langs->load("boxes"); - $sql = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc"; + $sql = "SELECT s.nom, s.rowid, s.datec as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -438,7 +438,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) $company->nom=$objp->nom; print ''; print ''; - print ''; + print ''; print ''; $var=!$var; $i++; @@ -533,7 +533,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) { $langs->load("propal"); - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -573,7 +573,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) print $propalstatic->getNomUrl(1); print ''; print ''; print '\n"; print "\n"; + print dol_print_date($db->jdate($obj->dp),'day')."\n"; print ""; print "\n"; print "\n"; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cbf32d6e5f0..acfe240a462 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1407,8 +1407,8 @@ if ($id > 0 || ! empty($ref)) $sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.marge_tx, pt.marque_tx, pt.pa_ht, pt.special_code,'; - $sql.= ' '.$db->pdate('pt.date_start').' as date_start,'; - $sql.= ' '.$db->pdate('pt.date_end').' as date_end,'; + $sql.= ' pt.date_start,'; + $sql.= ' pt.date_end,'; $sql.= ' pt.product_type,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc'; @@ -1473,7 +1473,7 @@ if ($id > 0 || ! empty($ref)) print $html->textwithtooltip($text,$description,3,'','',$i); // Show range - print_date_range($objp->date_start,$objp->date_end); + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); // Add description in form if ($conf->global->PRODUIT_DESC_IN_FORM) @@ -1513,7 +1513,7 @@ if ($id > 0 || ! empty($ref)) print $text.' '.nl2br($objp->description); // Show range - print_date_range($objp->date_start,$objp->date_end); + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); } print "\n"; } @@ -1716,18 +1716,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '' . "\n"; - /* - if ($conf->service->enabled) - { - print ""; - print ''; - print '' . "\n"; - } - */ + print "\n"; } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 8267289f558..c5cbd23a51b 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -38,7 +38,7 @@ $langs->load("companies"); $_socid = $_GET["id"]; if ($user->societe_id > 0) { - $_socid = $user->societe_id; + $_socid = $user->societe_id; } @@ -210,112 +210,112 @@ if ($_socid > 0) dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company'); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'.$obj->title.''.dol_print_date($obj->do,"day").''.dol_print_date($db->jdate($obj->do),"day").'
'.$langs->trans("LastChronodocs",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllChronodocs").' ('.$num.')
'.img_object($langs->trans("ShowChronodocs"),"generic")." ".$obj->ref.'".dol_trunc($obj->title,30) ."".dol_print_date($obj->dp,'day')."".dol_print_date($db->jdate($obj->dp),'day')."
'.$company->getNomUrl(1,'supplier',48).''.dol_print_date($objp->dc,'day').''.dol_print_date($db->jdate($objp->dc),'day').'
'; - if ($obj->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($db->jdate($obj->dp) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; $filename=dol_sanitizeFileName($obj->ref); @@ -586,7 +586,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) print "rowid."\">".img_object($langs->trans("ShowCompany"),"company")." ".dol_trunc($obj->nom,44).""; - print dol_print_date($obj->dp,'day')."".price($obj->total_ttc)."".$propalstatic->LibStatut($obj->fk_statut,3)."
'; print '
Si produit de type service a duree limitee: Du '; - print $html->select_date($objp->date_start,"date_start",0,0,$objp->date_start?0:1); - print ' au '; - print $html->select_date($objp->date_end,"date_end",0,0,$objp->date_end?0:1); - print '
'; + print '
'; - // Name + // Name print ''; print ''; // Calcul avoirs en cours - $remise_all=$remise_user=0; - $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " WHERE rc.fk_soc =". $objsoc->id; - $sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)"; - $sql.= " GROUP BY rc.fk_user"; - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $remise_all+=$obj->amount; - if ($obj->fk_user == $user->id) $remise_user+=$obj->amount; - } - else - { - dol_print_error($db); - } + $remise_all=$remise_user=0; + $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; + $sql.= " WHERE rc.fk_soc =". $objsoc->id; + $sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)"; + $sql.= " GROUP BY rc.fk_user"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $remise_all+=$obj->amount; + if ($obj->fk_user == $user->id) $remise_user+=$obj->amount; + } + else + { + dol_print_error($db); + } - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - print '
'.$langs->trans('Name').''; print $form->showrefnav($objsoc,'id','',1,'rowid','nom'); print '
'.$langs->trans("CustomerAbsoluteDiscountAllUsers").''.$remise_all.' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("CustomerAbsoluteDiscountAllUsers").''.$remise_all.' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->monnaie).'
'; + print '
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->monnaie).'
'; print '
'; print_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("AmountHT").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("VAT").''; + print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; + print ''; - print "
'.$langs->trans("AmountHT").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("VAT").''; $form->select_tva('tva_tx','0','',$mysoc,''); print '
'.$langs->trans("NoteReason").'
'.$langs->trans("NoteReason").'
"; + print "
"; - print "\n"; + print "\n"; - print '
'; + print '
'; - if ($_GET['action'] == 'remove') - { + if ($_GET['action'] == 'remove') + { $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); - } + } - /* - * Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture) - */ - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; - $sql.= $db->pdate("rc.datec")." as dc, rc.description,"; - $sql.= " rc.fk_facture_source,"; - $sql.= " u.login, u.rowid as user_id,"; + /* + * Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture) + */ + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql.= " rc.datec as dc, rc.description,"; + $sql.= " rc.fk_facture_source,"; + $sql.= " u.login, u.rowid as user_id,"; $sql.= " fa.facnumber as ref, fa.type as type"; - $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; $sql.= " WHERE rc.fk_soc =". $objsoc->id; - $sql.= " AND u.rowid = rc.fk_user"; + $sql.= " AND u.rowid = rc.fk_user"; $sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)"; - $sql.= " ORDER BY rc.datec DESC"; + $sql.= " ORDER BY rc.datec DESC"; - $resql=$db->query($sql); - if ($resql) - { - print_titre($langs->trans("DiscountStillRemaining")); - print ''; - print ''; - print ''; // Need 120+ for format with AM/PM - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $resql=$db->query($sql); + if ($resql) + { + print_titre($langs->trans("DiscountStillRemaining")); + print '
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").''.$langs->trans("AmountTTC").''.$langs->trans("DiscountOfferedBy").' 
'; + print ''; + print ''; // Need 120+ for format with AM/PM + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $var = true; - $i = 0 ; - $num = $db->num_rows($resql); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var = !$var; - print ""; - print ''; + $var = true; + $i = 0 ; + $num = $db->num_rows($resql); + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var = !$var; + print ""; + print ''; if ($obj->description == '(CREDIT_NOTE)') { - print ''; } - print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; if ($user->rights->societe->creer || $user->rights->facture->creer) @@ -352,11 +352,11 @@ if ($_socid > 0) print 'rowid.'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; } - else print ''; - print ''; + else print ''; + print ''; - if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) - { + if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid) + { print ""; print ''; print ''; - } - $i++; - } - $db->free($resql); - print "
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").''.$langs->trans("AmountTTC").''.$langs->trans("DiscountOfferedBy").' 
'.dol_print_date($obj->dc,'dayhour').'
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -324,7 +324,7 @@ if ($_socid > 0) } elseif ($obj->description == '(DEPOSIT)') { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -333,15 +333,15 @@ if ($_socid > 0) } else { - print ''; + print ''; print $obj->description; print ''.$langs->trans("NotConsumed").''.$langs->trans("NotConsumed").''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; + print ''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ' 
 
'; $amount1=price2num($obj->amount_ttc/2,'MT'); @@ -370,109 +370,109 @@ if ($_socid > 0) $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->monnaie)), 'confirm_split', $formquestion, 0, 0); print '
"; - } - else - { - dol_print_error($db); - } + } + $i++; + } + $db->free($resql); + print ""; + } + else + { + dol_print_error($db); + } - print '
'; + print '
'; - /* - * Liste ristournes appliquees (=liees a une ligne de facture ou facture) - */ + /* + * Liste ristournes appliquees (=liees a une ligne de facture ou facture) + */ - // Remises liees a lignes de factures - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; - $sql.= $db->pdate("rc.datec")." as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; - $sql.= " rc.fk_facture_source,"; + // Remises liees a lignes de factures + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; + $sql.= " rc.fk_facture_source,"; $sql.= " u.login, u.rowid as user_id,"; - $sql.= " f.rowid, f.facnumber,"; + $sql.= " f.rowid, f.facnumber,"; $sql.= " fa.facnumber as ref, fa.type as type"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql.= " , ".MAIN_DB_PREFIX."user as u"; - $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc"; - $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; - $sql.= " WHERE rc.fk_soc =". $objsoc->id; - $sql.= " AND rc.fk_facture_line = fc.rowid"; - $sql.= " AND fc.fk_facture = f.rowid"; - $sql.= " AND rc.fk_user = u.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql.= " , ".MAIN_DB_PREFIX."user as u"; + $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc"; + $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; + $sql.= " WHERE rc.fk_soc =". $objsoc->id; + $sql.= " AND rc.fk_facture_line = fc.rowid"; + $sql.= " AND fc.fk_facture = f.rowid"; + $sql.= " AND rc.fk_user = u.rowid"; $sql.= " ORDER BY dc DESC"; //$sql.= " UNION "; - // Remises liees a factures - $sql2= "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; - $sql2.= $db->pdate("rc.datec")." as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; - $sql2.= " rc.fk_facture_source,"; + // Remises liees a factures + $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; + $sql2.= " rc.fk_facture_source,"; $sql2.= " u.login, u.rowid as user_id,"; - $sql2.= " f.rowid, f.facnumber,"; + $sql2.= " f.rowid, f.facnumber,"; $sql2.= " fa.facnumber as ref, fa.type as type"; - $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql2.= " , ".MAIN_DB_PREFIX."user as u"; - $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; - $sql2.= " WHERE rc.fk_soc =". $objsoc->id; - $sql2.= " AND rc.fk_facture = f.rowid"; - $sql2.= " AND rc.fk_user = u.rowid"; + $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql2.= " , ".MAIN_DB_PREFIX."user as u"; + $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; + $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; + $sql2.= " WHERE rc.fk_soc =". $objsoc->id; + $sql2.= " AND rc.fk_facture = f.rowid"; + $sql2.= " AND rc.fk_user = u.rowid"; $sql2.= " ORDER BY dc DESC"; - $resql=$db->query($sql); + $resql=$db->query($sql); $resql2=null; - if ($resql) $resql2=$db->query($sql2); + if ($resql) $resql2=$db->query($sql2); if ($resql2) - { - print_titre($langs->trans("DiscountAlreadyCounted")); - print ''; - print ''; - print ''; // Need 120+ for format with AM/PM - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + { + print_titre($langs->trans("DiscountAlreadyCounted")); + print '
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").''.$langs->trans("AmountTTC").''.$langs->trans("Author").' 
'; + print ''; + print ''; // Need 120+ for format with AM/PM + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $var = true; + $var = true; $tab_sqlobj=array(); $tab_sqlobjOrder=array(); - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); for ($i = 0;$i < $num;$i++) - { + { $sqlobj = $db->fetch_object($resql); $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]=$sqlobj->dc; - } + $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc); + } $db->free($resql); $num = $db->num_rows($resql2); for ($i = 0;$i < $num;$i++) - { + { $sqlobj = $db->fetch_object($resql2); $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $sqlobj->dc; - } + $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc); + } $db->free($resql2); array_multisort ($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj); $num = sizeOf($tab_sqlobj); $i = 0 ; - while ($i < $num ) - { - $obj = array_shift($tab_sqlobj); - $var = !$var; - print ""; - print ''; + while ($i < $num ) + { + $obj = array_shift($tab_sqlobj); + $var = !$var; + print ""; + print ''; if ($obj->description == '(CREDIT_NOTE)') { - print ''; } - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - print ''; - $i++; - } - print "
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").''.$langs->trans("AmountTTC").''.$langs->trans("Author").' 
'.dol_print_date($obj->dc,'dayhour').'
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -481,7 +481,7 @@ if ($_socid > 0) } elseif ($obj->description == '(DEPOSIT)') { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -490,27 +490,27 @@ if ($_socid > 0) } else { - print ''; + print ''; print $obj->description; print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; + print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ' 
"; - } - else - { - print dol_print_error($db); - } + print ' '; + print ''; + $i++; + } + print ""; + } + else + { + print dol_print_error($db); + } } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 4f294cf9913..79506be4a65 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1033,7 +1033,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) { $sql = 'SELECT s.nom, s.prefix_comm, s.rowid'; $sql.= ', p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, p.fk_cond_reglement, p.fk_mode_reglement'; - $sql.= ', '.$db->pdate('p.datep').' as dp'; + $sql.= ', p.datep as dp'; $sql.= ', c.id as statut, c.label as lst'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'c_propalst as c'; $sql .= ' WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id'; @@ -1693,8 +1693,8 @@ else $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, '; $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc,'; - $sql.= ' '.$db->pdate('l.date_start').' as date_start,'; - $sql.= ' '.$db->pdate('l.date_end').' as date_end,'; + $sql.= ' l.date_start,'; + $sql.= ' l.date_end,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, '; $sql.= ' p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; @@ -1754,7 +1754,7 @@ else print $html->textwithtooltip($text,$description,3,'','',$i); // Show range - print_date_range($objp->date_start,$objp->date_end); + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); // Add description in form if ($conf->global->PRODUIT_DESC_IN_FORM) @@ -1795,7 +1795,7 @@ else print $text.' '.nl2br($objp->description); // Show range - print_date_range($objp->date_start,$objp->date_end); + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); } print ''; } @@ -1944,9 +1944,9 @@ else // Start and end dates selector print ''; print ''.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $html->select_date($objp->date_start,'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne"); + print $html->select_date($db->jdate($objp->date_start),'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne"); print ' '.$langs->trans('to').' '; - print $html->select_date($objp->date_end,'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne"); + print $html->select_date($db->jdate($objp->date_end),'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne"); print ''; print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index b5a6fbb6128..d4dd8445e12 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -254,7 +254,7 @@ else } // Recherche les ecritures pour le releve - $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv"; + $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv"; $sql.= ", b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " WHERE b.num_releve='".$num."'"; @@ -283,13 +283,13 @@ else print ""; // Date operation - print ''.dol_print_date($objp->do,"day").''; + print ''.dol_print_date($db->jdate($objp->do),"day").''; // Date de valeur print ''; print ''; print img_previous().' '; - print dol_print_date($objp->dv,"day") .' '; + print dol_print_date($db->jdate($objp->dv),"day") .' '; print ''; print img_next().''; print "\n"; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index f0c761126ae..875cfcbabe8 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -152,7 +152,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Remainder to pay in future // Customer invoices - $sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, ".$db->pdate("f.date_lim_reglement")." as dlr,"; + $sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; $sql.= " s.rowid as socid, s.nom, s.fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; @@ -161,7 +161,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql.= " ORDER BY dlr ASC"; // Supplier invoices - $sql2= " SELECT 'supplier_invoice' as family, ff.rowid as objid, ff.facnumber as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ".$db->pdate("ff.date_lim_reglement")." as dlr,"; + $sql2= " SELECT 'supplier_invoice' as family, ff.rowid as objid, ff.facnumber as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2.= " s.rowid as socid, s.nom, s.fournisseur"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; @@ -170,7 +170,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql2.= " ORDER BY dlr ASC"; // Social contributions - $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, ".$db->pdate("cs.date_ech")." as dlr"; + $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; $sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql3.= " WHERE cs.entity = ".$conf->entity; @@ -190,7 +190,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) { $sqlobj = $db->fetch_object($result); $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $sqlobj->dlr; + $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); } $db->free($result); } @@ -205,7 +205,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) { $sqlobj = $db->fetch_object($result2); $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $sqlobj->dlr; + $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); } $db->free($result2); } @@ -221,7 +221,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) { $sqlobj = $db->fetch_object($result3); $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $sqlobj->dlr; + $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); } $db->free($result3); } @@ -303,7 +303,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $solde += $total_ttc; print ""; - print ''.dol_print_date($obj->dlr,"day").""; + print ''.dol_print_date($db->jdate($obj->dlr),"day").""; print "".$ref.""; print "".$refcomp.""; if ($obj->total_ttc < 0) { print "".price($total_ttc)." "; }; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 0411f05bfa3..93ecf2e38d6 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -167,8 +167,8 @@ if ($_GET["facid"] > 0) * */ - $sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande"; - $sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite"; + $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; + $sql .= " , pfd.date_traite as date_traite"; $sql .= " , pfd.amount"; $sql .= " , u.rowid as user_id, u.name, u.firstname, u.login"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; @@ -222,7 +222,7 @@ if ($_GET["facid"] > 0) $var=!$var; print ""; - print ''.dol_print_date($obj->date_demande,'day')."\n"; + print ''.dol_print_date($db->jdate($obj->date_demande),'day')."\n"; print 'En attente de traitement'; print ''.price($obj->amount).''; print '-'; @@ -243,8 +243,8 @@ if ($_GET["facid"] > 0) dol_print_error($db); } - $sql = "SELECT pfd.rowid, pfd.traite,".$db->pdate("pfd.date_demande")." as date_demande"; - $sql .= " ,".$db->pdate("pfd.date_traite")." as date_traite"; + $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande"; + $sql .= " , pfd.date_traite"; $sql .= " , pfd.fk_prelevement_bons, pfd.amount"; $sql .= " , u.rowid as user_id, u.name, u.firstname, u.login"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; @@ -267,9 +267,9 @@ if ($_GET["facid"] > 0) print ""; - print ''.dol_print_date($obj->date_demande)."\n"; + print ''.dol_print_date($db->jdate($obj->date_demande))."\n"; - print ''.dol_print_date($obj->date_traite)."\n"; + print ''.dol_print_date($db->jdate($obj->date_traite))."\n"; print ''.price($obj->amount).''; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index ae4235bba98..d50d11d9f82 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -348,7 +348,7 @@ else // Liste des cheques $sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,"; - $sql.= " ".$db->pdate("b.dateo")." as date,".$db->pdate("b.datec")." as datec, b.banque,"; + $sql.= " b.dateo as date, b.datec as datec, b.banque,"; $sql.= " p.rowid as pid"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank as b";