Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
This commit is contained in:
commit
091fbb2824
@ -500,7 +500,7 @@ elseif ($modecompta == "BOOKKEEPING")
|
||||
}
|
||||
|
||||
/*
|
||||
* Charges sociales non deductibles
|
||||
* Social contributions
|
||||
*/
|
||||
|
||||
$subtotal_ht = 0;
|
||||
@ -513,7 +513,6 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE cs.fk_type = c.id";
|
||||
$sql .= " AND c.deductible = 0";
|
||||
if (!empty($date_start) && !empty($date_end))
|
||||
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -525,7 +524,6 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql .= " WHERE p.fk_charge = cs.rowid";
|
||||
$sql .= " AND cs.fk_type = c.id";
|
||||
$sql .= " AND c.deductible = 0";
|
||||
if (!empty($date_start) && !empty($date_end))
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -533,69 +531,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY c.libelle, dm";
|
||||
|
||||
dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0;
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
|
||||
if (!isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm] = 0;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
elseif ($modecompta == "BOOKKEEPING")
|
||||
{
|
||||
// Nothing from this table
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Charges sociales deductibles
|
||||
*/
|
||||
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
||||
{
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE cs.fk_type = c.id";
|
||||
$sql .= " AND c.deductible = 1";
|
||||
if (!empty($date_start) && !empty($date_end))
|
||||
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
elseif ($modecompta == "RECETTES-DEPENSES")
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql .= " WHERE p.fk_charge = cs.rowid";
|
||||
$sql .= " AND cs.fk_type = c.id";
|
||||
$sql .= " AND c.deductible = 1";
|
||||
if (!empty($date_start) && !empty($date_end))
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY c.libelle, dm";
|
||||
|
||||
dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
|
||||
dol_syslog("get social contributions", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -735,7 +671,7 @@ elseif ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
|
||||
/*
|
||||
* Donation get dunning paiement
|
||||
* Donation get dunning payments
|
||||
*/
|
||||
|
||||
if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
||||
|
||||
@ -332,7 +332,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
||||
$sql .= " WHERE c.entity IN (".getEntity('supplier_order').")";
|
||||
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
else $sql .= " AND c.rowid=".$id;
|
||||
|
||||
@ -907,6 +907,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (!$error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user