Beispiel #1
0
 $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
 // Unset extrafield
 if (is_array($extralabelsline)) {
     // Get extra fields
     foreach ($extralabelsline as $key => $value) {
         unset($_POST["options_" . $key]);
     }
 }
 // Define special_code for special lines
 $special_code = GETPOST('special_code');
 if (!GETPOST('qty')) {
     $special_code = 3;
 }
 $line = new FactureLigne($db);
 $line->fetch(GETPOST('lineid'));
 $percent = $line->get_prev_progress();
 if (GETPOST('progress') < $percent) {
     $mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
     setEventMessages($mesg, null, 'warnings');
     $error++;
     $result = -1;
 }
 // Check minimum price
 $productid = GETPOST('productid', 'int');
 if (!empty($productid)) {
     $product = new Product($db);
     $product->fetch($productid);
     $type = $product->type;
     $price_min = $product->price_min;
     if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) {
         $price_min = $product->multiprices_min[$object->thirdparty->price_level];
Beispiel #2
0
         $compta_prod = !empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
     }
 }
 $cpttva = !empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
 $compta_tva = !empty($obj->account_tva) ? $obj->account_tva : $cpttva;
 // Situation invoices handling
 $line = new FactureLigne($db);
 $line->fetch($obj->fdid);
 // id of line
 $prev_progress = 0;
 if ($obj->type == Facture::TYPE_SITUATION) {
     // Avoid divide by 0
     if ($obj->situation_percent == 0) {
         $situation_ratio = 0;
     } else {
         $prev_progress = $line->get_prev_progress($obj->rowid);
         // id of invoice
         $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
     }
 } else {
     $situation_ratio = 1;
 }
 // Invoice lines
 $tabfac[$obj->rowid]["date"] = $obj->df;
 $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
 $tabfac[$obj->rowid]["type"] = $obj->type;
 $tabfac[$obj->rowid]["description"] = $obj->label_compte;
 $tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
 if (!isset($tabttc[$obj->rowid][$compta_soc])) {
     $tabttc[$obj->rowid][$compta_soc] = 0;
 }
Beispiel #3
0
 $cptcli = !empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
 $compta_soc = !empty($obj->code_compta) ? $obj->code_compta : $cptcli;
 $compta_prod = $obj->compte;
 if (empty($compta_prod)) {
     if ($obj->product_type == 0) {
         $compta_prod = !empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
     } else {
         $compta_prod = !empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
     }
 }
 $cpttva = !empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
 $compta_tva = !empty($obj->account_tva) ? $obj->account_tva : $cpttva;
 // Situation invoices handling
 $line = new FactureLigne($db);
 $line->fetch($obj->rowid);
 $prev_progress = $line->get_prev_progress();
 if ($obj->type == Facture::TYPE_SITUATION) {
     // Avoid divide by 0
     if ($obj->situation_percent == 0) {
         $situation_ratio = 0;
     } else {
         $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
     }
 } else {
     $situation_ratio = 1;
 }
 // Invoice lines
 $tabfac[$obj->rowid]["date"] = $obj->df;
 $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
 $tabfac[$obj->rowid]["type"] = $obj->type;
 $tabfac[$obj->rowid]["description"] = $obj->label_compte;
Beispiel #4
0
 $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
 // Unset extrafield
 if (is_array($extralabelsline)) {
     // Get extra fields
     foreach ($extralabelsline as $key => $value) {
         unset($_POST["options_" . $key]);
     }
 }
 // Define special_code for special lines
 $special_code = GETPOST('special_code');
 if (!GETPOST('qty')) {
     $special_code = 3;
 }
 $line = new FactureLigne($db);
 $line->fetch(GETPOST('lineid'));
 $percent = $line->get_prev_progress($object->id);
 if (GETPOST('progress') < $percent) {
     $mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
     setEventMessages($mesg, null, 'warnings');
     $error++;
     $result = -1;
 }
 // Check minimum price
 $productid = GETPOST('productid', 'int');
 if (!empty($productid)) {
     $product = new Product($db);
     $product->fetch($productid);
     $type = $product->type;
     $price_min = $product->price_min;
     if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) {
         $price_min = $product->multiprices_min[$object->thirdparty->price_level];