':
- print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
- $j++;
- if ($j < $nbofsalesrepresentative) {
- print ' ';
+ }
+
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print '
';
+
+ print '';
+ // Picto + Ref
+ print '| ';
+ print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
+ print ' | ';
+ // Warning
+ $warnornote = '';
+ if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
+ $warnornote .= img_warning($langs->trans("Late"));
+ }
+ if ($warnornote) {
+ print '';
+ print $warnornote;
+ print ' | ';
+ }
+ // Other picto tool
+ print '';
+ $filename = dol_sanitizeFileName($obj->ref);
+ $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref);
+ $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
+ print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
+ print ' | ';
+
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ if (!empty($arrayfields['p.ref_client']['checked'])) {
+ // Customer ref
+ print '
';
+ print dol_escape_htmltag($obj->ref_client);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ if (!empty($arrayfields['pr.ref']['checked'])) {
+ // Project ref
+ print '
';
+ if ($obj->project_id > 0) {
+ print $projectstatic->getNomUrl(1);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ if (!empty($arrayfields['pr.title']['checked'])) {
+ // Project label
+ print '
';
+ if ($obj->project_id > 0) {
+ print dol_escape_htmltag($projectstatic->title);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Thirdparty
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '
';
+ print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Alias
+ if (!empty($arrayfields['s.name_alias']['checked'])) {
+ print '
';
+ print $obj->alias;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Town
+ if (!empty($arrayfields['s.town']['checked'])) {
+ print '
';
+ print $obj->town;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Zip
+ if (!empty($arrayfields['s.zip']['checked'])) {
+ print '
';
+ print $obj->zip;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // State
+ if (!empty($arrayfields['state.nom']['checked'])) {
+ print "
".$obj->state_name." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Country
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
+ print '
';
+ $tmparray = getCountry($obj->fk_pays, 'all');
+ print $tmparray['label'];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Type ent
+ if (!empty($arrayfields['typent.code']['checked'])) {
+ if (!is_array($typenArray) || empty($typenArray)) {
+ $typenArray = $formcompany->typent_array(1);
+ }
+
+ print '
';
+ print $typenArray[$obj->typent_code];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Date proposal
+ if (!empty($arrayfields['p.date']['checked'])) {
+ print '
';
+ print dol_print_date($db->jdate($obj->dp), 'day');
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Date end validity
+ if (!empty($arrayfields['p.fin_validite']['checked'])) {
+ if ($obj->dfv) {
+ print '
'.dol_print_date($db->jdate($obj->dfv), 'day');
+ print ' | ';
+ } else {
+ print '
| ';
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date delivery
+ if (!empty($arrayfields['p.date_livraison']['checked'])) {
+ if ($obj->ddelivery) {
+ print '
'.dol_print_date($db->jdate($obj->ddelivery), 'day');
+ print ' | ';
+ } else {
+ print '
| ';
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date Signature
+ if (!empty($arrayfields['p.date_signature']['checked'])) {
+ if ($obj->dsignature) {
+ print '
'.dol_print_date($db->jdate($obj->dsignature), 'day');
+ print ' | ';
+ } else {
+ print '
| ';
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Availability
+ if (!empty($arrayfields['ava.rowid']['checked'])) {
+ print '
';
+ $form->form_availability('', $obj->availability, 'none', 1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Shipping Method
+ if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
+ print '
';
+ $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Source - input reason
+ if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
+ print '
';
+ if ($obj->fk_input_reason > 0) {
+ print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Payment terms
+ if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
+ print '
';
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Payment mode
+ if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) {
+ print '
';
+ $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount HT
+ if (!empty($arrayfields['p.total_ht']['checked'])) {
+ print '
'.price($obj->total_ht)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
+ }
+ if (empty($totalarray['val']['p.total_ht'])) {
+ $totalarray['val']['p.total_ht'] = $obj->total_ht;
+ } else {
+ $totalarray['val']['p.total_ht'] += $obj->total_ht;
+ }
+ }
+ // Amount VAT
+ if (!empty($arrayfields['p.total_tva']['checked'])) {
+ print '
'.price($obj->total_tva)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva';
+ }
+ if (empty($totalarray['val']['p.total_tva'])) {
+ $totalarray['val']['p.total_tva'] = $obj->total_tva;
+ } else {
+ $totalarray['val']['p.total_tva'] += $obj->total_tva;
+ }
+ }
+ // Amount TTC
+ if (!empty($arrayfields['p.total_ttc']['checked'])) {
+ print '
'.price($obj->total_ttc)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
+ }
+ if (empty($totalarray['val']['p.total_ttc'])) {
+ $totalarray['val']['p.total_ttc'] = $obj->total_ttc;
+ } else {
+ $totalarray['val']['p.total_ttc'] += $obj->total_ttc;
+ }
+ }
+ // Amount invoiced HT
+ if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
+ print '
'.price($totalInvoicedHT)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
+ }
+ if (empty($totalarray['val']['p.total_ht_invoiced'])) {
+ $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT;
+ } else {
+ $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
+ }
+ }
+ // Amount invoiced TTC
+ if (!empty($arrayfields['p.total_invoiced']['checked'])) {
+ print '
'.price($totalInvoicedTTC)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
+ }
+ if (empty($totalarray['val']['p.total_invoiced'])) {
+ $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC;
+ } else {
+ $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC;
+ }
+ }
+ // Currency
+ if (!empty($arrayfields['p.multicurrency_code']['checked'])) {
+ print '
'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Currency rate
+ if (!empty($arrayfields['p.multicurrency_tx']['checked'])) {
+ print '
';
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount HT
+ if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) {
+ print '
'.price($obj->multicurrency_total_ht)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount VAT
+ if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) {
+ print '
'.price($obj->multicurrency_total_tva)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount TTC
+ if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) {
+ print '
'.price($obj->multicurrency_total_ttc)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount invoiced
+ if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) {
+ print '
'.price($multicurrency_totalInvoicedHT)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount invoiced
+ if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) {
+ print '
'.price($multicurrency_totalInvoicedTTC)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ $userstatic->id = $obj->fk_user_author;
+ $userstatic->login = $obj->login;
+ $userstatic->lastname = $obj->lastname;
+ $userstatic->firstname = $obj->firstname;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
+ $userstatic->entity = $obj->user_entity;
+ $userstatic->photo = $obj->photo;
+ $userstatic->office_phone = $obj->office_phone;
+ $userstatic->office_fax = $obj->office_fax;
+ $userstatic->user_mobile = $obj->user_mobile;
+ $userstatic->job = $obj->job;
+ $userstatic->gender = $obj->gender;
+
+ // Author
+ if (!empty($arrayfields['u.login']['checked'])) {
+ print '
';
+ if ($userstatic->id) {
+ print $userstatic->getNomUrl(-1);
+ }
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ if (!empty($arrayfields['sale_representative']['checked'])) {
+ // Sales representatives
+ print '
';
+ if ($obj->socid > 0) {
+ $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
+ if ($listsalesrepresentatives < 0) {
+ dol_print_error($db);
+ }
+ $nbofsalesrepresentative = count($listsalesrepresentatives);
+ if ($nbofsalesrepresentative > 6) {
+ // We print only number
+ print $nbofsalesrepresentative;
+ } elseif ($nbofsalesrepresentative > 0) {
+ $userstatic = new User($db);
+ $j = 0;
+ foreach ($listsalesrepresentatives as $val) {
+ $userstatic->id = $val['id'];
+ $userstatic->lastname = $val['lastname'];
+ $userstatic->firstname = $val['firstname'];
+ $userstatic->email = $val['email'];
+ $userstatic->statut = $val['statut'];
+ $userstatic->entity = $val['entity'];
+ $userstatic->photo = $val['photo'];
+ $userstatic->login = $val['login'];
+ $userstatic->office_phone = $val['office_phone'];
+ $userstatic->office_fax = $val['office_fax'];
+ $userstatic->user_mobile = $val['user_mobile'];
+ $userstatic->job = $val['job'];
+ $userstatic->gender = $val['gender'];
+ //print ' ':
+ print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
+ $j++;
+ if ($j < $nbofsalesrepresentative) {
+ print ' ';
+ }
+ //print ' ';
}
- //print '';
+ }
+ //else print $langs->trans("NoSalesRepresentativeAffected");
+ } else {
+ print ' ';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Total buying or cost price
+ if (!empty($arrayfields['total_pa']['checked'])) {
+ print '
'.price($marginInfo['pa_total']).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Total margin
+ if (!empty($arrayfields['total_margin']['checked'])) {
+ print '
'.price($marginInfo['total_margin']).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
+ }
+ $totalarray['val']['total_margin'] = $total_margin;
+ }
+ // Total margin rate
+ if (!empty($arrayfields['total_margin_rate']['checked'])) {
+ print '
'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Total mark rate
+ if (!empty($arrayfields['total_mark_rate']['checked'])) {
+ print '
'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
+ }
+ if ($i >= $imaxinloop - 1) {
+ if (!empty($total_ht)) {
+ $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
+ } else {
+ $totalarray['val']['total_mark_rate'] = '';
}
}
- //else print $langs->trans("NoSalesRepresentativeAffected");
- } else {
- print ' ';
}
- print '