|
|
|
|
@@ -3618,18 +3618,15 @@ if ($action == 'create') {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
|
|
|
|
print '<div class="tagtable">'."\n";
|
|
|
|
|
print '<div class="listofinvoicetypetable">'."\n";
|
|
|
|
|
|
|
|
|
|
// Standard invoice
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOSTINT('type') ? '' : ' checked').'> ';
|
|
|
|
|
$tmp = $tmp.'<label for="radio_standard" >'.$langs->trans("InvoiceStandardAsk").'</label>';
|
|
|
|
|
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
|
|
|
|
|
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', 'nowraponall', 0, 3, 'standardonsmartphone');
|
|
|
|
|
print '<table class="nobordernopadding"><tr>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</td>';
|
|
|
|
|
if ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid))) {
|
|
|
|
|
/*print '<td class="nowrap" style="padding-left: 5px">';
|
|
|
|
|
$arraylist = array(
|
|
|
|
|
@@ -3639,17 +3636,14 @@ if ($action == 'create') {
|
|
|
|
|
);
|
|
|
|
|
print $form->selectarray('typestandard', $arraylist, GETPOST('typestandard', 'aZ09'), 0, 0, 0, '', 1);
|
|
|
|
|
print '</td>';*/
|
|
|
|
|
print '<td class="nowrap" style="padding-left: 15px">';
|
|
|
|
|
print '<span class="opacitymedium">'.$langs->trans('PercentOfOriginalObject').'</span>:<input class="right" placeholder="100%" type="text" id="valuestandardinvoice" name="valuestandardinvoice" size="3" value="'.(GETPOSTISSET('valuestandardinvoice') ? GETPOST('valuestandardinvoice', 'alpha') : '100%').'"/>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<span class="opacitymedium marginleftonly">'.$langs->trans('PercentOfOriginalObject').'</span>:<input class="right" placeholder="100%" type="text" id="valuestandardinvoice" name="valuestandardinvoice" size="3" value="'.(GETPOSTISSET('valuestandardinvoice') ? GETPOST('valuestandardinvoice', 'alpha') : '100%').'"/>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr></table>';
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
|
|
|
|
|
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) {
|
|
|
|
|
// Deposit - Down payment
|
|
|
|
|
if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) {
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOSTINT('type') == 3 ? ' checked' : '').'> ';
|
|
|
|
|
print '<script type="text/javascript">
|
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
|
@@ -3660,13 +3654,23 @@ if ($action == 'create') {
|
|
|
|
|
jQuery("#radio_deposit").prop("checked", true);
|
|
|
|
|
});
|
|
|
|
|
jQuery("#typedeposit").change(function() {
|
|
|
|
|
console.log("We change type of down payment");
|
|
|
|
|
console.log("We change type of down payment: "+jQuery("#typedeposit").val());
|
|
|
|
|
|
|
|
|
|
if (jQuery("#typedeposit").val() == "amount") {
|
|
|
|
|
jQuery("#valuedeposit").attr("placeholder", "'.$langs->getCurrencySymbol($conf->currency).'");
|
|
|
|
|
jQuery("#valuedeposit").val("");
|
|
|
|
|
} else {
|
|
|
|
|
jQuery("#valuedeposit").attr("placeholder", "50%");
|
|
|
|
|
jQuery("#valuedeposit").val("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jQuery("#radio_deposit").prop("checked", true);
|
|
|
|
|
setRadioForTypeOfInvoice();
|
|
|
|
|
});
|
|
|
|
|
jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() {
|
|
|
|
|
setRadioForTypeOfInvoice();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function setRadioForTypeOfInvoice() {
|
|
|
|
|
console.log("Change radio for type of invoice");
|
|
|
|
|
if (jQuery("#radio_deposit").prop("checked") && (jQuery("#typedeposit").val() == \'amount\' || jQuery("#typedeposit").val() == \'variable\')) {
|
|
|
|
|
@@ -3684,15 +3688,11 @@ if ($action == 'create') {
|
|
|
|
|
});
|
|
|
|
|
</script>';
|
|
|
|
|
|
|
|
|
|
print '<table class="nobordernopadding"><tr>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
$tmp = $tmp.'<label for="radio_deposit">'.$langs->trans("InvoiceDeposit").'</label>';
|
|
|
|
|
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
|
|
|
|
|
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone');
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</td>';
|
|
|
|
|
if (($origin == 'propal') || ($origin == 'commande')) {
|
|
|
|
|
print '<td class="nowrap" style="padding-left: 15px">';
|
|
|
|
|
$arraylist = array(
|
|
|
|
|
'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')),
|
|
|
|
|
'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')),
|
|
|
|
|
@@ -3709,42 +3709,39 @@ if ($action == 'create') {
|
|
|
|
|
if (empty($valuedeposit) && $typedeposit == 'variable' && !empty($objectsrc->deposit_percent)) {
|
|
|
|
|
$valuedeposit = $objectsrc->deposit_percent;
|
|
|
|
|
}
|
|
|
|
|
print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="nowrap" style="padding-left: 5px">';
|
|
|
|
|
print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span>';
|
|
|
|
|
print '<input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.($valuedeposit ? $valuedeposit : '').'"/>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<span class="marginleftonly">'.$form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1).'</span>';
|
|
|
|
|
//print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span>';
|
|
|
|
|
print '<input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.($valuedeposit ? $valuedeposit : '').'"'.($valudeposit ? '' : 'placeholder="'.$langs->getCurrencySymbol($conf->currency).'"').'>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr></table>';
|
|
|
|
|
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($socid > 0) {
|
|
|
|
|
if (getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
|
|
// First situation invoice
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input id="radio_situation" type="radio" name="type" value="5"'.(GETPOST('type') == 5 ? ' checked' : '').'> ';
|
|
|
|
|
$tmp = $tmp.'<label for="radio_situation" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>';
|
|
|
|
|
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
|
|
|
|
|
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone');
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
|
|
|
|
|
// Next situation invoice
|
|
|
|
|
$opt = $form->selectSituationInvoices((string) GETPOSTINT('originid'), $socid);
|
|
|
|
|
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
//print ' ';
|
|
|
|
|
print '</div></div><div class="listofinvoicetype"><div>';
|
|
|
|
|
|
|
|
|
|
$tmp = '<input id="radio_situation_bis" type="radio" name="type" value="5"'.(GETPOST('type') == 5 && GETPOSTINT('originid') ? ' checked' : '');
|
|
|
|
|
if ($opt == ('<option value ="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
|
|
|
|
|
if ($opt == ('<option value="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
|
|
|
|
|
$tmp .= ' disabled';
|
|
|
|
|
}
|
|
|
|
|
$tmp .= '> ';
|
|
|
|
|
$text = $tmp.'<label for="radio_situation_bis">'.$langs->trans("InvoiceSituationAsk").'</label> ';
|
|
|
|
|
$text .= '<select class="flat" id="situations" name="situations"';
|
|
|
|
|
if ($opt == ('<option value ="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
|
|
|
|
|
$text .= '<select class="flat minwidth50" id="situations" name="situations"';
|
|
|
|
|
if ($opt == ('<option value="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
|
|
|
|
|
$text .= ' disabled';
|
|
|
|
|
}
|
|
|
|
|
$text .= '>';
|
|
|
|
|
@@ -3752,7 +3749,7 @@ if ($action == 'create') {
|
|
|
|
|
$text .= '</select>';
|
|
|
|
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Replacement
|
|
|
|
|
@@ -3777,7 +3774,7 @@ if ($action == 'create') {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<!-- replacement line -->';
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" name="type" id="radio_replacement" value="1"'.(GETPOST('type') == 1 ? ' checked' : '');
|
|
|
|
|
if (!$options || $invoice_predefined->id > 0) {
|
|
|
|
|
$tmp .= ' disabled';
|
|
|
|
|
@@ -3786,6 +3783,7 @@ if ($action == 'create') {
|
|
|
|
|
print '<script type="text/javascript">
|
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
|
jQuery("#fac_replacement").change(function() {
|
|
|
|
|
console.log("We change fac_replacement");
|
|
|
|
|
jQuery("#radio_replacement").prop("checked", true);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
@@ -3805,26 +3803,25 @@ if ($action == 'create') {
|
|
|
|
|
$text .= '</select>';
|
|
|
|
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (getDolGlobalString('INVOICE_USE_SITUATION')) {
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
|
|
|
|
$text = $tmp.'<label>'.$langs->trans("InvoiceSituationAsk").'</label> ';
|
|
|
|
|
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
|
|
|
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', 'nowraponall', 0, 3, 'firstsituationonsmartphone');
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
|
|
|
|
$text = $tmp.'<label for="radio_replacement" class="opacitymedium">'.$langs->trans("InvoiceReplacement").'</label> ';
|
|
|
|
|
//$text .= '<span class="opacitymedium hideonsmartphone">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
|
|
|
|
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'<br><br>'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', 'nowraponall', 0, 3, 'replacementonsmartphone');
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (empty($origin)) {
|
|
|
|
|
@@ -3861,7 +3858,7 @@ if ($action == 'create') {
|
|
|
|
|
$optionsav .= '</option>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" id="radio_creditnote" name="type" value="2"'.(GETPOST('type') == 2 ? ' checked' : '');
|
|
|
|
|
if ((!$optionsav && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) || $invoice_predefined->id > 0) {
|
|
|
|
|
$tmp .= ' disabled';
|
|
|
|
|
@@ -3881,9 +3878,11 @@ if ($action == 'create') {
|
|
|
|
|
jQuery("#credit_note_options").hide();
|
|
|
|
|
}
|
|
|
|
|
jQuery("#radio_creditnote").click(function() {
|
|
|
|
|
|
|
|
|
|
jQuery("#credit_note_options").show();
|
|
|
|
|
});
|
|
|
|
|
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
|
|
|
|
jQuery("#radio_standard, #radio_replacement, #radio_deposit, #radio_situation, #radio_situation_bis").click(function() {
|
|
|
|
|
console.log("We click on a radio to close credit not options");
|
|
|
|
|
jQuery("#credit_note_options").hide();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
@@ -3895,7 +3894,7 @@ if ($action == 'create') {
|
|
|
|
|
}
|
|
|
|
|
$text .= '>';
|
|
|
|
|
if ($optionsav) {
|
|
|
|
|
$text .= '<option value="-1"></option>';
|
|
|
|
|
$text .= '<option value="-1">'.$langs->trans("InvoiceAvoirAskCombo").'</option>';
|
|
|
|
|
$text .= $optionsav;
|
|
|
|
|
} else {
|
|
|
|
|
$text .= '<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
|
|
|
|
|
@@ -3905,14 +3904,15 @@ if ($action == 'create') {
|
|
|
|
|
print $desc;
|
|
|
|
|
|
|
|
|
|
print '<div id="credit_note_options" class="clearboth paddingtop marginbottomonly">';
|
|
|
|
|
print ' <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithLines') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
|
|
|
|
print '<br> <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithPaymentRestAmount') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
|
|
|
|
print '<div class="marginleftlarge"><input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithLines') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithLines" class="small">'.$langs->trans('invoiceAvoirWithLines')."</label></div>";
|
|
|
|
|
//print '<br>';
|
|
|
|
|
print '<div class="marginleftlarge"><input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithPaymentRestAmount') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithPaymentRestAmount" class="small">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label></div>";
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
if (!getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) {
|
|
|
|
|
$tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
|
|
|
|
} else {
|
|
|
|
|
@@ -3927,12 +3927,12 @@ if ($action == 'create') {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Template invoice
|
|
|
|
|
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
|
|
|
|
print '<div class="listofinvoicetype"><div class="">';
|
|
|
|
|
$tmp = '<input type="radio" name="type" id="radio_template" value="0" disabled> ';
|
|
|
|
|
$text = $tmp.'<label class="opacitymedium" for="radio_template">'.$langs->trans("RepeatableInvoice").'</label> ';
|
|
|
|
|
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone');
|
|
|
|
|
print $desc;
|
|
|
|
|
print '</div></div>';
|
|
|
|
|
print '</div></div>'."\n";
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
|