diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5b3449ea5df05..206ffd030fe56 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2451,431 +2451,435 @@ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + // Call Hook OrderCard + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('OrderCard', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print $langs->trans('OutstandingBill'); + print ' | '; + $arrayoutstandingbills = $soc->getOutstandingBills(); + print price($arrayoutstandingbills['opened']).' / '; + print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); + print ' | '; + print '
'; - print $langs->trans('OutstandingBill'); - print ' | '; - $arrayoutstandingbills = $soc->getOutstandingBills(); - print price($arrayoutstandingbills['opened']).' / '; - print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); - print ' | '; - print '|
'.$langs->trans('Discounts').' | '; - $addrelativediscount = 'id.'">'.$langs->trans("EditRelativeDiscounts").''; - $addabsolutediscount = 'id.'">'.$langs->trans("EditGlobalDiscounts").''; - $addcreditnote = 'id.'">'.$langs->trans("AddCreditNote").''; + $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); + $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - print ' | |
'.$langs->trans('Discounts').' | '; + $thirdparty = $soc; + $discount_type = 0; + $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + print ' | |
'; + $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Date", 'date', '', $object, $editenable); + print ' | '; + if ($action == 'editdate') { + print ''; + } else { + print $object->date ? dol_print_date($object->date, 'day') : ' '; + if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } + } + print ' | '; + print '|
'; + $editenable = $usercancreate; + print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); + print ' | '; + if ($action == 'editdate_livraison') { + print ''; + } else { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } + } + print ' | '; + print '|
'; - $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; - print $form->editfieldkey("Date", 'date', '', $object, $editenable); - print ' | '; - if ($action == 'editdate') { - print ''; - } else { - print $object->date ? dol_print_date($object->date, 'day') : ' '; - if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + // Delivery delay + print ' | |
'; + $editenable = $usercancreate; + print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); + print ' | '; + if ($action == 'editavailability') { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + } else { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); } - } - print ' | '; - print '|
'; - $editenable = $usercancreate; - print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); - print ' | '; - if ($action == 'editdate_livraison') { - print ''; - } else { - print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->delivery_date)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + // Shipping Method + if (isModEnabled('expedition')) { + print ' | |
'; + $editenable = $usercancreate; + print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); + print ' | '; + if ($action == 'editshippingmethod') { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + } else { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + } + print ' | '; + print '|
'; - $editenable = $usercancreate; - print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); - print ' | '; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); - } - print ' | |
'; + $editenable = $usercancreate; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); + print ' | '; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + } else { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + } + print ' | '; + print '|
'; $editenable = $usercancreate; - print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); + print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable); print ' | '; - if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + if ($action == 'editdemandreason') { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); } - print ' | '; - print '|
'; $editenable = $usercancreate; - print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); + print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); print ' | '; - if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent); } print ' | '; - print '|
'; - $editenable = $usercancreate; - print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable); - print ' | '; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); - } - print ' | |
'; - $editenable = $usercancreate; - print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); - print ' | '; - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent); - } - print ' | '; - - print '|
'; - $editenable = $usercancreate; - print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); - print ' | '; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print ' | |
'; - $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; - print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); + // Mode of payment + print ' | ||
'; + $editenable = $usercancreate; + print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); print ' | '; - if ($action == 'editmulticurrencycode') { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } else { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print ' | |
'; - $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == $object::STATUS_DRAFT; - print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); + $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); print ' | ';
- if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
- if ($action == 'actualizemulticurrencyrate') {
- list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
- }
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ if ($action == 'editmulticurrencycode') {
+ $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code');
} else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
- print ' ';
- print 'id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'';
- print ' ';
- }
+ $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none');
}
print ' | |
'; - $editenable = $usercancreate; - print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); - print ' | '; - if ($action == 'editinputmode') { - $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); - } else { - $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none'); - } - print ' | |
'.$langs->trans("CalculatedWeight").' | '; - print ''; - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); - print ' | |
'.$langs->trans("CalculatedVolume").' | '; - print ''; - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); - print ' | |
'; + $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == $object::STATUS_DRAFT; + print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); + print ' | ';
+ if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
+ if ($action == 'actualizemulticurrencyrate') {
+ list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
+ }
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ print ' ';
+ print 'id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'';
+ print ' ';
+ }
+ }
+ print ' | |
'; $editenable = $usercancreate; - print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); - print ' | '; - print ''; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); + print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); + print ' | '; + if ($action == 'editinputmode') { + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none'); } print ' |
'; - $editenable = $usercancreate; - print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); - print ' | '; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + $tmparray = $object->getTotalWeightVolume(); + $totalWeight = $tmparray['weight']; + $totalVolume = $tmparray['volume']; + if ($totalWeight) { + print ' | |
'.$langs->trans("CalculatedWeight").' | '; + print ''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); + print ' | |
'.$langs->trans("CalculatedVolume").' | '; + print ''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + print ' |
' . $langs->trans('AmountHT') . ' | '; + print '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . ' | '; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount HT + print '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; + } + print '|||
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ' | '; - print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . ' | '; + print '' . $langs->trans('AmountVAT') . ' | '; + print '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . ' | '; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; + // Multicurrency Amount VAT + print '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; } print '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ' | '; - print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . ' | '; + print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ' | '; + print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . ' | '; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; + print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; } print '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ' | '; + print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . ' | '; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . ' | '; + } + print '|||
' . $langs->trans('AmountTTC') . ' | '; - print '' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . ' | '; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount TTC - print '' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . ' | '; - } - print '|||
' . $langs->trans('AmountTTC') . ' | '; + print '' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . ' | '; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount TTC + print '' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . ' | '; + } + print '