From 79ddc2458daee215f8b9417e9cb7fa2f049b2c5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2016 12:51:09 +0200 Subject: [PATCH 1/5] Better center of left, center and right part of titles. --- htdocs/core/lib/cron.lib.php | 4 ++-- htdocs/core/lib/functions.lib.php | 10 ++++++---- htdocs/cron/admin/cron.php | 1 + htdocs/cron/list.php | 11 +++++++---- htdocs/langs/en_US/cron.lang | 1 + 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index d7a0a57ac37..64a4c5ef031 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -104,7 +104,7 @@ function dol_print_cron_urls() print ''.$langs->trans("FileToLaunchCronJobs").':
'; $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' [cronjobid]'; - print '
\n"; + print '
\n"; print '
'; // Add note @@ -116,7 +116,7 @@ function dol_print_cron_urls() { print $langs->trans("CronExplainHowToRunUnix"); print '
'; - print '
'; + print '
'; } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dfa724e7c64..6bc46e1dfcf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3117,19 +3117,21 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print ''; // Left - if ($picto && $titre) print ''; - print ''; + print ''; // Center if ($center) { - print ''; + print ''; } // Right - print ''; + print ''; // Remainder to pay print ''; - print ''; + print ''; print ''; } else // Credit note @@ -3376,7 +3376,7 @@ else if ($id > 0 || ! empty($ref)) print ' :'; // Billed - print ''; + print ''; // Remainder to pay back print ''; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 675544566e8..6a43a60a829 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -981,7 +981,7 @@ else print ''.fieldLabel('ThirdPartyName','name').''; } print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; - print ''; + print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; @@ -1001,7 +1001,7 @@ else // Alias names (commercial, trademark or alias names) print ''; - print ''; + print ''; // Prospect/Customer print ''; @@ -1015,7 +1015,7 @@ else print ''; print ''; - print ''; print '
'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'
'.$titre; + //if ($picto && $titre) print '
'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).''; + if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle" id="pictotitle"', $pictoisfullpath); + print '
'.$titre; if (!empty($titre) && $savtotalnboflines > 0) print ' ('.$totalnboflines.')'; print '
'.$center.''.$center.''; + print ''; if ($sortfield) $options .= "&sortfield=".$sortfield; if ($sortorder) $options .= "&sortorder=".$sortorder; // Show navigation bar diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 697b24fcc1e..f41978eb757 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -109,6 +109,7 @@ print ''; print '

'; print $langs->trans("UseMenuModuleToolsToAddCronJobs").'
'; +if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)); print '

'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 69fa4867526..49d916d2d9d 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -275,9 +275,6 @@ print ''; print ''; print ''; -print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $stringcurrentdate, $num, $nbtotalofrecords, 'title_setup', 0, '', '', $limit); - - // Line with explanation and button new job if (! $user->rights->cron->create) { @@ -287,7 +284,13 @@ else { $buttontoshow.=''.$langs->trans("CronCreateJob").''; } -print '
'.$langs->trans('CronInfo').''.$buttontoshow.'
'; + +print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttontoshow, $num, $nbtotalofrecords, 'title_setup', 0, '', '', $limit); + + +print $langs->trans('CronInfo').'
'; +print $stringcurrentdate.'
'; +if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)); print '
'; diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index b6d7bcf6545..6a700aa5760 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -76,3 +76,4 @@ UseMenuModuleToolsToAddCronJobs=Go into menu "Home - Admin tools - Scheduled job JobDisabled=Job disabled MakeLocalDatabaseDumpShort=Local database backup MakeLocalDatabaseDump=Create a local database dump +WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of active jobs, your jobs may be delayed to a maximum of %s hours before being run. From b5dad8cfbf7d7c942c3f9aa895aa16cb7ce04b33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2016 00:29:19 +0200 Subject: [PATCH 2/5] Better responsive --- htdocs/compta/facture.php | 8 ++-- htdocs/societe/soc.php | 18 ++++---- htdocs/theme/eldy/style.css.php | 82 +++++++++++++++++++++++---------- htdocs/theme/md/style.css.php | 4 +- 4 files changed, 73 insertions(+), 39 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 91694fdf8cd..0ef7c830e68 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3356,7 +3356,7 @@ else if ($id > 0 || ! empty($ref)) } // Billed - print '
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; @@ -3365,7 +3365,7 @@ else if ($id > 0 || ! empty($ref)) else print $langs->trans('ExcessReceived'); print ' :' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
' . price($sign * $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
'; @@ -3385,7 +3385,7 @@ else if ($id > 0 || ! empty($ref)) else print $langs->trans('ExcessPaydBack'); print ' :' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans('Prefix').'
'.fieldLabel('ProspectCustomer','customerprospect',1).''.fieldLabel('CustomerCode','customer_code').''; + print ''.fieldLabel('CustomerCode','customer_code').''; print ''; // Country - print ''; @@ -1103,9 +1103,9 @@ else // Phone / Fax print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Prof ids $i=1; $j=0; @@ -1541,7 +1541,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print ''; print ''; print ''; - print ''; - // List of payments - - $sign = 1; - if ($object->type == Facture::TYPE_CREDIT_NOTE) - $sign = - 1; - - $nbrows = 8; - $nbcols = 3; - if (! empty($conf->projet->enabled)) - $nbrows ++; - if (! empty($conf->banque->enabled)) { - $nbrows ++; $nbcols++; - } - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $nbrows ++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) - $nbrows ++; - if ($selleruserevenustamp) - $nbrows ++; - if (! empty($conf->multicurrency->enabled)) $nbrows+=5; - if (! empty($conf->incoterm->enabled)) $nbrows+=1; - - print ''; - if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) { // Date invoice @@ -3414,7 +3145,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print '
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); @@ -1074,7 +1074,7 @@ else print '
'.fieldLabel('Country','selectcountry_id').''; + print '
'.fieldLabel('Country','selectcountry_id').''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Phone','phone').''.fieldLabel('Fax','fax').'
'.fieldLabel('CustomerCode','customer_code').''; + print ''.fieldLabel('CustomerCode','customer_code').''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Prof ids $i=1; $j=0; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1d860f5f378..d2834a87669 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -277,7 +277,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla } input, textarea, select { - border-radius:4px; + border-radius: 2px; border:solid 1px rgba(0,0,0,.3); border-top:solid 1px rgba(0,0,0,.3); border-bottom:solid 1px rgba(0,0,0,.2); @@ -337,7 +337,6 @@ textarea:disabled { input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; } input[type=radio] { background-color: transparent; border: none; box-shadow: none; } input[type=image] { background-color: transparent; border: none; box-shadow: none; } -input[type=text] { min-width: 20px; } input:-webkit-autofill { background-color: !important; background-image:none !important; @@ -380,9 +379,9 @@ fieldset { border: 1px solid #AAAAAA !important; } filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #bbbbbb; border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); @@ -599,17 +598,21 @@ div.myavailability { .clearboth { clear:both; } .hideobject { display: none; } .minwidth50 { min-width: 50px; } -.minwidth100 { min-width: 100px; } -.minwidth200 { min-width: 200px; } -.minwidth300 { min-width: 300px; } -.minwidth400 { min-width: 400px; } -.minwidth500 { min-width: 500px; } -.minwidth50imp { min-width: 50px !important; } -.minwidth100imp { min-width: 100px !important; } -.minwidth200imp { min-width: 200px !important; } -.minwidth300imp { min-width: 300px !important; } -.minwidth400imp { min-width: 400px !important; } -.minwidth500imp { min-width: 500px !important; } +/* rule to reduce top menu - 3rd reduction */ +@media only screen and (min-width: px) +{ + .minwidth100 { min-width: 100px; } + .minwidth200 { min-width: 200px; } + .minwidth300 { min-width: 300px; } + .minwidth400 { min-width: 400px; } + .minwidth500 { min-width: 500px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 100px !important; } + .minwidth200imp { min-width: 200px !important; } + .minwidth300imp { min-width: 300px !important; } + .minwidth400imp { min-width: 400px !important; } + .minwidth500imp { min-width: 500px !important; } +} .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -648,6 +651,8 @@ div.myavailability { /* Force values for small screen */ @media only screen and (max-width: 570px) { + input[type=text] { min-width: 20px; } + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } @@ -2081,9 +2086,9 @@ span.butAction, span.butActionDelete { filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #bbbbbb; border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); @@ -4287,20 +4292,40 @@ ul.ulmenu { } /* Style for first level menu with jmobile */ +.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { + padding: .9em 15px; + display: block; +} +.ui-btn-up-c { + font-weight: normal; +} +.ui-bar-b { + border: 1px solid #888; + text-shadow: none; +} +.ui-focus, .ui-btn:focus { + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} .ui-bar-b, .lilevel0 { - border: 1px solid #888 !important; +/* border: 1px solid #888 !important; */ background: rgb(); background-repeat: repeat-x; +/* background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);*/ font-weight: bold; color: rgb() !important; } +.ui-li.ui-last-child, .ui-li.ui-field-contain.ui-last-child { + border-bottom-width: 0px !important; +} .alilevel0 { color: rgb() !important; text-shadow: 1px 0px 1px #; @@ -4313,7 +4338,7 @@ ul.ulmenu { text-shadow: none; } .ui-btn-up-c, .ui-btn-hover-c { - border: 1px solid #ccc; + /* border: 1px solid #ccc; */ text-shadow: none; } .ui-body-c .ui-link, .ui-body-c .ui-link:visited, .ui-body-c .ui-link:hover { @@ -4487,7 +4512,7 @@ img.demothumb { /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { div.tmenucenter { max-width: px; /* size of viewport */ @@ -4533,9 +4558,12 @@ img.demothumb { background-size: 20px auto; margin-top: 2px; } + select { + width: 100%; + } } /* rule to reduce top menu - 3rd reduction */ -@media only screen and (max-width: 660px) +@media only screen and (max-width: px) { /* Reduce login top right info */ .usertextatoplogin { @@ -4588,6 +4616,12 @@ img.demothumb { position: absolute; width: px; } + select { + width: 100%; + max-width: 100px; + min-width: 0 !important; + } + } ); background-repeat: repeat-x; - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + /*background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);*/ font-weight: bold; color: rgb() !important; From 133657a8c7db8d18093ca35bea1eff8597cc4bed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2016 01:25:34 +0200 Subject: [PATCH 3/5] Uniformize code --- htdocs/compta/facture.php | 868 ++++++++++-------- htdocs/compta/facture/class/facture.class.php | 2 + htdocs/core/class/html.formmargin.class.php | 2 +- htdocs/core/lib/functions.lib.php | 6 + htdocs/paypal/lib/paypal.lib.php | 2 +- htdocs/theme/eldy/style.css.php | 9 + 6 files changed, 482 insertions(+), 407 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0ef7c830e68..c15d67e127b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -395,10 +395,10 @@ if (empty($reshook)) } } - else if ($action == 'set_ref_client' && $user->rights->facture->creer) + else if ($action == 'setref_client' && $user->rights->facture->creer) { $object->fetch($id); - $object->set_ref_client($_POST['ref_client']); + $object->set_ref_client(GETPOST('ref_client')); } // Classify to validated @@ -2878,11 +2878,61 @@ else if ($id > 0 || ! empty($ref)) // Invoice content - print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) @@ -1656,9 +1656,9 @@ else // Phone / Fax print '
'.fieldLabel('Phone','phone').''.fieldLabel('Fax','fax').'
'; - $linkback = '' . $langs->trans("BackToList") . ''; - + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + $object->totalpaye = $totalpaye; // To give a change to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref + /* print ''; print ''; + print '';*/ // Type - print ''; print '
' . $langs->trans('Ref') . ''; $morehtmlright = ''; @@ -2946,10 +2996,10 @@ else if ($id > 0 || ! empty($ref)) } print ')'; } - print '
' . $langs->trans('Type') . ''; + print '
' . $langs->trans('Type') . ''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { $facreplaced = new Facture($db); @@ -2990,7 +3040,7 @@ else if ($id > 0 || ! empty($ref)) $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; print '
' . $langs->trans('Discounts'); - print ''; + print ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -3071,7 +3121,7 @@ else if ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print '
'; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editinvoicedate') { @@ -3084,327 +3134,8 @@ else if ($id > 0 || ! empty($ref)) } print ''; - - if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) - { - if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print ''; - - if (count($object->tab_previous_situation_invoice) > 0) - { - //List of previous invoices - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $total_prev_ht = $total_prev_ttc = 0; - $var = true; - foreach ($object->tab_previous_situation_invoice as $prev_invoice) - { - $totalpaye = $prev_invoice->getSommePaiement(); - $total_prev_ht += $prev_invoice->total_ht; - $total_prev_ttc += $prev_invoice->total_ttc; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $var = !$var; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - if (count($object->tab_next_situation_invoice) > 0) - { - //List of next invoices - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $total_next_ht = $total_next_ttc = 0; - - $var = true; - foreach ($object->tab_next_situation_invoice as $next_invoice) - { - $totalpaye = $next_invoice->getSommePaiement(); - $total_next_ht += $next_invoice->total_ht; - $total_next_ttc += $next_invoice->total_ttc; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; - print ''; - print ''; - - $var = !$var; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '
' . $langs->trans('ListOfPreviousSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
'.$prev_invoice->getNomUrl(1).'' . price($prev_invoice->total_ht) . '' . price($prev_invoice->total_ttc) . ''.$prev_invoice->getLibStatut(3, $totalpaye).'
' . price($total_prev_ht) . '' . price($total_prev_ttc) . ' 
' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
'.$next_invoice->getNomUrl(1).'' . price($next_invoice->total_ht) . '' . price($next_invoice->total_ttc) . ''.$next_invoice->getLibStatut(3, $totalpaye).'
' . price($total_next_ht) . '' . price($total_next_ttc) . ' 
'; - } - - print ''; - - // List of payments already done - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) - print ''; - print ''; - print ''; print ''; - $var = true; - - // Payments already done (from payment on this invoice) - $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; - $sql .= ' c.code as payment_code, c.libelle as payment_label,'; - $sql .= ' pf.amount,'; - $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label'; - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_paiement as c, ' . MAIN_DB_PREFIX . 'paiement_facture as pf, ' . MAIN_DB_PREFIX . 'paiement as p'; - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; - $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; - $sql .= ' ORDER BY p.datep, p.tms'; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - - // if ($object->type != 2) - // { - if ($num > 0) - { - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var = ! $var; - print ''; - print ''; - $label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label; - print ''; - if (! empty($conf->banque->enabled)) - { - $bankaccountstatic->id = $objp->baid; - $bankaccountstatic->ref = $objp->baref; - $bankaccountstatic->label = $objp->baref; - print ''; - } - print ''; - print ''; - print ''; - $i ++; - } - } else { - print ''; - } - // } - $db->free($result); - } else { - dol_print_error($db); - } - - if ($object->type != Facture::TYPE_CREDIT_NOTE) - { - // Total already paid - print ''; - - $resteapayeraffiche = $resteapayer; - - // Loop on each credit note or deposit amount applied - $creditnoteamount = 0; - $depositamount = 0; - $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; - $sql .= " re.description, re.fk_facture_source"; - $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; - $sql .= " WHERE fk_facture = " . $object->id; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $invoice = new Facture($db); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $invoice->fetch($obj->fk_facture_source); - print ''; - print ''; - print ''; - $i ++; - if ($invoice->type == Facture::TYPE_CREDIT_NOTE) - $creditnoteamount += $obj->amount_ttc; - if ($invoice->type == Facture::TYPE_DEPOSIT) - $depositamount += $obj->amount_ttc; - } - } else { - dol_print_error($db); - } - - // Paye partiellement 'escompte' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') { - print ''; - $resteapayeraffiche = 0; - } - // Paye partiellement ou Abandon 'badcustomer' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') { - print ''; - // $resteapayeraffiche=0; - } - // Paye partiellement ou Abandon 'product_returned' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') { - print ''; - $resteapayeraffiche = 0; - } - // Paye partiellement ou Abandon 'abandon' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') { - print ''; - $resteapayeraffiche = 0; - } - - // Billed - print ''; - - // Remainder to pay - print ''; - print ''; - print ''; - } - else // Credit note - { - // Total already paid back - print ''; - - // Billed - print ''; - - // Remainder to pay back - print ''; - print ''; - print ''; - - // Sold credit note - // print ''; - // print ''; - } - - print '
' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '' . $langs->trans('Date') . '' . $langs->trans('Type') . '' . $langs->trans('BankAccount') . '' . $langs->trans('Amount') . ' 
'; - $paymentstatic->id=$objp->rowid; - $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; - $paymentstatic->num_paiement=$objp->num_paiement; - $paymentstatic->payment_code=$objp->payment_code; - print $paymentstatic->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dp), 'day') . '' . $label . ' ' . $objp->num_paiement . ''; - if ($bankaccountstatic->id) - print $bankaccountstatic->getNomUrl(1, 'transactions'); - print '' . price($sign * $objp->amount) . ' 
' . $langs->trans("None") . '
'; - if ($object->type != Facture::TYPE_DEPOSIT) - print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); - else - print $langs->trans('AlreadyPaid'); - print ' :' . price($totalpaye) . ' 
'; - if ($invoice->type == Facture::TYPE_CREDIT_NOTE) - print $langs->trans("CreditNote") . ' '; - if ($invoice->type == Facture::TYPE_DEPOSIT) - print $langs->trans("Deposit") . ' '; - print $invoice->getNomUrl(0); - print ' :' . price($obj->amount_ttc) . ''; - print 'rowid . '">' . img_delete() . ''; - print '
'; - print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; - $text = $langs->trans("HelpAbandonOther"); - if ($object->close_note) - $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; - print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); - print '
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; - if ($resteapayeraffiche >= 0) - print $langs->trans('RemainderToPay'); - else - print $langs->trans('ExcessReceived'); - print ' :' . price($resteapayeraffiche) . ' 
'; - print $langs->trans('AlreadyPaidBack'); - print ' :' . price($sign * $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
'; - if ($resteapayeraffiche <= 0) - print $langs->trans('RemainderToPayBack'); - else - print $langs->trans('ExcessPaydBack'); - print ' :' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans('TotalTTC').' :'.price($sign * - // $object->total_ttc).' 
'; - - // Margin Infos - if (! empty($conf->margin->enabled)) - { - print '
'; - $formmargin->displayMarginInfos($object, $object->statut > 0); - } - - print '
id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print '
'; + print ''; if ($action == 'editdate_pointoftax') { $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax'); } else { @@ -3431,7 +3162,7 @@ else if ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; - print ''; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editconditions') { @@ -3452,7 +3183,7 @@ else if ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; - print ''; + print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editpaymentterm') { @@ -3476,7 +3207,7 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); @@ -3499,7 +3230,7 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { @@ -3516,7 +3247,7 @@ else if ($id > 0 || ! empty($ref)) if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -3533,7 +3264,7 @@ else if ($id > 0 || ! empty($ref)) if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); @@ -3566,7 +3297,7 @@ else if ($id > 0 || ! empty($ref)) print $object->situation_counter; print ''; - print ''; + print ''; $prevsits_total_amount = 0; foreach ($prevsits as $situation) { @@ -3587,7 +3318,7 @@ else if ($id > 0 || ! empty($ref)) print $prevsits[$i]->situation_counter; print ''; - print ''; + print ''; print '- ' . price($prevsits[$i]->total_ht); print ''; print '' . $langs->trans('Currency' . $conf->currency) . ''; @@ -3595,71 +3326,8 @@ else if ($id > 0 || ! empty($ref)) } } - // Amount - print '' . $langs->trans('AmountHT') . ''; - print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; - print '' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ''; - print ''; - - // Amount Local Taxes - if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 - { - print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ''; - print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ''; - } - if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 - { - print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ''; - print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ''; - } - - // Revenue stamp - if ($selleruserevenustamp) // Test company use revenue stamp - { - print ''; - print ''; - if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) - print ''; - print '
'; - print $langs->trans('RevenueStamp'); - print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '
'; - print ''; - if ($action == 'editrevenuestamp') { - print '
'; - print ''; - print ''; - print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); - // print ''; - print ' '; - print '
'; - } else { - print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency); - } - print ''; - } - - // Total with tax - print '' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ''; - - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; - print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount VAT - print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; - print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - - // Multicurrency Amount TTC - print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; - print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; - print ''; - } - // Statut + /* print '' . $langs->trans('Status') . ''; print '' . ($object->getLibStatut(4, $totalpaye)) . ''; @@ -3687,7 +3355,7 @@ else if ($id > 0 || ! empty($ref)) } print ''; print ''; - } + }*/ // Incoterms if (!empty($conf->incoterm->enabled)) @@ -3700,7 +3368,7 @@ else if ($id > 0 || ! empty($ref)) else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -3713,11 +3381,401 @@ else if ($id > 0 || ! empty($ref)) } // Other attributes - $cols = 5; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - print '
'; + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + // Amount + print ''; + print ''; + print ''; + print ''; + + // Amount Local Taxes + if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 + { + print ''; + print ''; + } + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 + { + print ''; + print ''; + } + + // Revenue stamp + if ($selleruserevenustamp) // Test company use revenue stamp + { + print ''; + } + + // Total with tax + print ''; + + if (!empty($conf->multicurrency->enabled)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + + print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) + { + print ''; + } + print '
'; + print $langs->trans('RevenueStamp'); + print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '
'; + print '
'; + if ($action == 'editrevenuestamp') { + print '
'; + print ''; + print ''; + print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); + // print ''; + print ' '; + print '
'; + } else { + print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency); + } + print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; + + // List of payments + + $sign = 1; + if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1; + $nbrows = 8; + $nbcols = 3; + if (! empty($conf->projet->enabled)) + $nbrows ++; + if (! empty($conf->banque->enabled)) { + $nbrows ++; + $nbcols ++; + } + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) + $nbrows ++; + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) + $nbrows ++; + if ($selleruserevenustamp) + $nbrows ++; + if (! empty($conf->multicurrency->enabled)) + $nbrows += 5; + if (! empty($conf->incoterm->enabled)) + $nbrows += 1; + + if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION)) + { + if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) + print ''; + + if (count($object->tab_previous_situation_invoice) > 0) { + // List of previous invoices + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $total_prev_ht = $total_prev_ttc = 0; + $var = true; + foreach ($object->tab_previous_situation_invoice as $prev_invoice) { + $totalpaye = $prev_invoice->getSommePaiement(); + $total_prev_ht += $prev_invoice->total_ht; + $total_prev_ttc += $prev_invoice->total_ttc; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $var = ! $var; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + if (count($object->tab_next_situation_invoice) > 0) { + // List of next invoices + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $total_next_ht = $total_next_ttc = 0; + + $var = true; + foreach ($object->tab_next_situation_invoice as $next_invoice) { + $totalpaye = $next_invoice->getSommePaiement(); + $total_next_ht += $next_invoice->total_ht; + $total_next_ttc += $next_invoice->total_ttc; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) + print ''; + print ''; + print ''; + print ''; + print ''; + + $var = ! $var; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) + print '
' . $langs->trans('ListOfPreviousSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
' . $prev_invoice->getNomUrl(1) . '' . price($prev_invoice->total_ht) . '' . price($prev_invoice->total_ttc) . '' . $prev_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_prev_ht) . '' . price($total_prev_ttc) . ' 
' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
' . $next_invoice->getNomUrl(1) . '' . price($next_invoice->total_ht) . '' . price($next_invoice->total_ttc) . '' . $next_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_next_ht) . '' . price($total_next_ttc) . ' 
'; + } + + print ''; + + // List of payments already done + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) { + print ''; + } + print ''; + print ''; + print ''; + + $var = true; + + // Payments already done (from payment on this invoice) + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; + $sql .= ' c.code as payment_code, c.libelle as payment_label,'; + $sql .= ' pf.amount,'; + $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label'; + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_paiement as c, ' . MAIN_DB_PREFIX . 'paiement_facture as pf, ' . MAIN_DB_PREFIX . 'paiement as p'; + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; + $sql .= ' ORDER BY p.datep, p.tms'; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i = 0; + + // if ($object->type != 2) + // { + if ($num > 0) { + while ($i < $num) { + $objp = $db->fetch_object($result); + $var = ! $var; + print ''; + print ''; + $label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label; + print ''; + if (! empty($conf->banque->enabled)) { + $bankaccountstatic->id = $objp->baid; + $bankaccountstatic->ref = $objp->baref; + $bankaccountstatic->label = $objp->baref; + print ''; + } + print ''; + print ''; + print ''; + $i ++; + } + } else { + print ''; + } + // } + $db->free($result); + } else { + dol_print_error($db); + } + + if ($object->type != Facture::TYPE_CREDIT_NOTE) { + // Total already paid + print ''; + + $resteapayeraffiche = $resteapayer; + + // Loop on each credit note or deposit amount applied + $creditnoteamount = 0; + $depositamount = 0; + $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; + $sql .= " re.description, re.fk_facture_source"; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; + $sql .= " WHERE fk_facture = " . $object->id; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $invoice = new Facture($db); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $invoice->fetch($obj->fk_facture_source); + print ''; + print ''; + print ''; + $i ++; + if ($invoice->type == Facture::TYPE_CREDIT_NOTE) + $creditnoteamount += $obj->amount_ttc; + if ($invoice->type == Facture::TYPE_DEPOSIT) + $depositamount += $obj->amount_ttc; + } + } else { + dol_print_error($db); + } + + // Paye partiellement 'escompte' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') { + print ''; + $resteapayeraffiche = 0; + } + // Paye partiellement ou Abandon 'badcustomer' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') { + print ''; + // $resteapayeraffiche=0; + } + // Paye partiellement ou Abandon 'product_returned' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') { + print ''; + $resteapayeraffiche = 0; + } + // Paye partiellement ou Abandon 'abandon' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') { + print ''; + $resteapayeraffiche = 0; + } + + // Billed + print ''; + + // Remainder to pay + print ''; + print ''; + print ''; + } + else // Credit note + { + // Total already paid back + print ''; + + // Billed + print ''; + + // Remainder to pay back + print ''; + print ''; + print ''; + + // Sold credit note + // print ''; + // print ''; + } + + print '
' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '' . $langs->trans('Date') . '' . $langs->trans('Type') . '' . $langs->trans('BankAccount') . '' . $langs->trans('Amount') . ' 
'; + $paymentstatic->id = $objp->rowid; + $paymentstatic->datepaye = $db->jdate($objp->dp); + $paymentstatic->ref = $objp->ref; + $paymentstatic->num_paiement = $objp->num_paiement; + $paymentstatic->payment_code = $objp->payment_code; + print $paymentstatic->getNomUrl(1); + print '' . dol_print_date($db->jdate($objp->dp), 'day') . '' . $label . ' ' . $objp->num_paiement . ''; + if ($bankaccountstatic->id) + print $bankaccountstatic->getNomUrl(1, 'transactions'); + print '' . price($sign * $objp->amount) . ' 
' . $langs->trans("None") . '
'; + if ($object->type != Facture::TYPE_DEPOSIT) + print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); + else + print $langs->trans('AlreadyPaid'); + print ' :' . price($totalpaye) . ' 
'; + if ($invoice->type == Facture::TYPE_CREDIT_NOTE) + print $langs->trans("CreditNote") . ' '; + if ($invoice->type == Facture::TYPE_DEPOSIT) + print $langs->trans("Deposit") . ' '; + print $invoice->getNomUrl(0); + print ' :' . price($obj->amount_ttc) . ''; + print 'rowid . '">' . img_delete() . ''; + print '
'; + print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
'; + $text = $langs->trans("HelpAbandonOther"); + if ($object->close_note) + $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; + print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); + print '
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
'; + if ($resteapayeraffiche >= 0) + print $langs->trans('RemainderToPay'); + else + print $langs->trans('ExcessReceived'); + print ' :' . price($resteapayeraffiche) . ' 
'; + print $langs->trans('AlreadyPaidBack'); + print ' :' . price($sign * $totalpaye) . ' 
' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' 
'; + if ($resteapayeraffiche <= 0) + print $langs->trans('RemainderToPayBack'); + else + print $langs->trans('ExcessPaydBack'); + print ' :' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans('TotalTTC').' :'.price($sign * + // $object->total_ttc).' 
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + } + + print '
'; + print '
'; + print ''; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 32e6ca242ca..e0ceb287ea9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1516,6 +1516,8 @@ class Facture extends CommonInvoice */ function set_ref_client($ref_client, $notrigger=0) { + global $user; + $error=0; $this->db->begin(); diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 99159f62561..0ac6012f271 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -209,7 +209,7 @@ class FormMargin if (!empty($hidemargininfos)) print ''; } - print ''; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6bc46e1dfcf..7c4a19d729b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -986,6 +986,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlright.=$object->getLibStatut(5,1); } } + elseif ($object->element == 'facture') + { + $tmptxt=$object->getLibStatut(6, $object->totalpaye); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5, $object->totalpaye); + $morehtmlright.=$tmptxt; + } else { $tmptxt=$object->getLibStatut(6); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5); diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 6587e25ecb1..1496bb3552e 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -209,7 +209,7 @@ function showPaypalPaymentUrl($type,$ref) $out='

'; $out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'
'; $url=getPaypalPaymentUrl(0,$type,$ref); - $out.='
'; + $out.='
'; return $out; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index d2834a87669..f415b214742 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -580,6 +580,14 @@ div.myavailability { .tablelistofcalendars { margin-top: 25px !important; } +.amountalreadypaid { + color: #008800; + font-weight: bold; +} +.amountremaintopay { + color: #880000; + font-weight: bold; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ .table-responsive { @@ -2833,6 +2841,7 @@ tr.liste_sub_total, tr.liste_sub_total td { border-top-width: px !important; border-top-color: rgb() !important; border-top-style: solid !important; + margin: 0px 0px 0px 0px !important; } .paymenttable tr td:first-child, .margintable tr td:first-child { From d759296c024276c334f6854ce2b0baeb97c4d936 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2016 01:39:05 +0200 Subject: [PATCH 4/5] Fix color of amount --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c15d67e127b..d2482fee4b7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3651,7 +3651,7 @@ else if ($id > 0 || ! empty($ref)) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' :'; + print ' :'; $resteapayeraffiche = $resteapayer; From 39c4feaef70b5798906e21b642b039f1b56083e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2016 03:54:54 +0200 Subject: [PATCH 5/5] Enhancement for usage on smartphone --- htdocs/core/class/extrafields.class.php | 52 +++++++++++++------- htdocs/core/class/html.form.class.php | 4 +- htdocs/core/class/html.formcompany.class.php | 7 ++- htdocs/core/class/html.formfile.class.php | 12 +++-- htdocs/societe/soc.php | 16 +++--- htdocs/theme/eldy/style.css.php | 4 ++ 6 files changed, 58 insertions(+), 37 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5b1b935d24d..88f6d317952 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -657,7 +657,7 @@ class ExtraFields * @param string $moreparam To add more parametes on html input tag * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @param int $showsize Value for size attributed + * @param mixed $showsize Value for css to define size. May also be a numeric. * @param int $objectid Current object id * @return string */ @@ -680,23 +680,37 @@ class ExtraFields { if ($type == 'date') { - $showsize=10; + //$showsize=10; + $showsize = 'minwidth100imp'; } elseif ($type == 'datetime') { - $showsize=19; + //$showsize=19; + $showsize = 'minwidth200imp'; } elseif (in_array($type,array('int','double'))) { - $showsize=10; + //$showsize=10; + $showsize = 'minwidth100imp'; } else { - $showsize=round($size); - if ($showsize > 48) $showsize=48; + if (round($size) < 12) + { + $showsize = 'minwidth100imp'; + } + else if (round($size) <= 48) + { + $showsize = 'minwidth200imp'; + } + else + { + //$showsize=48; + $showsize = 'minwidth400imp'; + } } } - + if (in_array($type,array('date','datetime'))) { $tmp=explode(',',$size); @@ -718,11 +732,11 @@ class ExtraFields { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -738,26 +752,26 @@ class ExtraFields } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'mail') { - $out=''; + $out=''; } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { if (!empty($value)) { $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { @@ -768,7 +782,7 @@ class ExtraFields $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); } - $out.=''; $out.=''; foreach ($param['options'] as $key => $val) { @@ -790,7 +804,7 @@ class ExtraFields $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); } - $out.=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); @@ -971,7 +985,7 @@ class ExtraFields $out=''; foreach ($param['options'] as $keyopt=>$val ) { - $out.=''; @@ -1146,7 +1160,7 @@ class ExtraFields if (!empty($value)) $object->fetch($value); $valuetoshow=$object->ref; if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique - $out.=''; + $out.=''; } else { @@ -1156,7 +1170,7 @@ class ExtraFields } elseif ($type == 'password') { - $out=''; + $out=''; } if (!empty($hidden)) { $out=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b035095b1a7..910afcdfd96 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -598,7 +598,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -1444,7 +1444,7 @@ class Form $nodatarole=($comboenhancement?' data-role="none"':''); } - $out.= ''; if ($show_empty) $out.= ''."\n"; if ($show_every) $out.= ''."\n"; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 05bbbd941d9..70dc0e253c4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -232,7 +232,7 @@ class FormCompany $result=$this->db->query($sql); if ($result) { - if (!empty($htmlname)) $out.= ''; if ($country_codeid) $out.= ''; $num = $this->db->num_rows($result); $i = 0; @@ -743,7 +743,7 @@ class FormCompany $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; $moreattrib.=' autocomplete="off"'; } - $out.= ''."\n"; + $out.= ''."\n"; return $out; } @@ -792,9 +792,8 @@ class FormCompany $maxlength=$formlength; if (empty($formlength)) { $formlength=24; $maxlength=128; } - $formlength=0; - $out = ''; + $out = ''; return $out; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e52818305b5..b8fab63f906 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -731,7 +731,7 @@ class FormFile } /** - * Show only Document icon with link + * Show a Document icon with link(s) * * @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. @@ -748,6 +748,8 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); + if (! empty($conf->dol_use_jmobile)) return ''; + $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment @@ -755,7 +757,7 @@ class FormFile if (! empty($file_list)) { $out='
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').'' . price($totalpaye) . ' 
0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' 
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); - print ''; + print ''; print ''; $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); @@ -1039,7 +1039,7 @@ else print ''; print ''; print ''; print ''; } @@ -1510,11 +1510,11 @@ else // Name print ''; - print ''; + print ''; // Alias names (commercial, trademark or alias names) print ''; - print ''; + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -1694,7 +1694,7 @@ else // VAT Code print ''; print '
'; $tmpcode=$object->code_fournisseur; if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1); - print ''; + print ''; print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); @@ -1137,7 +1137,7 @@ else print ''.fieldLabel('VATIntra','intra_vat').''; - $s = ''; + $s = ''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -1220,7 +1220,7 @@ else if (! empty($conf->global->MAIN_MULTILANGS)) { print '
'.fieldLabel('DefaultLang','default_lang').''."\n"; - print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); + print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1,0,0,'maxwidth200onsmartphone'); print '
'.fieldLabel('ThirdPartyName','name',1).'
'.fieldLabel('VATIntra','intra_vat').''; - $s =''; + $s =''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { @@ -2040,7 +2040,7 @@ else { $s=''; $s.=$object->tva_intra; - $s.=''; + $s.=''; if (empty($conf->global->MAIN_DISABLEVATCHECK)) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f415b214742..8eb7e277a00 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3973,8 +3973,12 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container-multi .select2-choices { + background-image: none; +} .select2-container .select2-choice { color: #000; + border-radius: 0; } .selectoptiondisabledwhite { background: #FFFFFF !important;