$totaltickets = 0; foreach ($tabfac as $key => $val) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; print "<tr " . $bc[$var] . ">"; // third party print "<td>" . dol_print_date($val["date"], "day") . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; foreach ($tabttc[$key] as $k => $mt) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['client']; print "<td>" . $k; print "</td><td>" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td><td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td>"; $totalclient += $mt; } print "</tr>"; // product foreach ($tabht[$key] as $k => $mt) { if ($mt) { print "<tr " . $bc[$var] . ">"; print "<td>" . dol_print_date($val["date"], "day") . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; //print "<td>".$invoicestatic->getNomUrl(1)."</td>"; print "<td>" . $k . "</td><td>" . $langs->trans("Products") . "</td><td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td></tr>"; $totalp += $mt; } }
/** * Show actions to do array * * @param int $max Max nb of records * @return void */ function show_array_actions_to_do($max = 5) { global $langs, $conf, $user, $db, $bc, $socid; $now = dol_now(); include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; include_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; $sql .= " c.code, c.libelle as type_label,"; $sql .= " s.nom as sname, s.rowid, s.client"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_actioncomm as c LEFT JOIN "; $sql .= " " . MAIN_DB_PREFIX . "actioncomm as a ON c.id = a.fk_action"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE a.entity = " . $conf->entity; $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '" . $db->idate($now) . "'))"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $socid; } $sql .= " ORDER BY a.datep DESC, a.id DESC"; $sql .= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("LastActionsToDo", $max) . '</td>'; print '<td colspan="2" align="right"><a href="' . DOL_URL_ROOT . '/comm/action/listactions.php?status=todo">' . $langs->trans("FullList") . '</a>'; print '</tr>'; $var = true; $i = 0; $staticaction = new ActionComm($db); $customerstatic = new Client($db); while ($i < $num) { $obj = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; $staticaction->type_code = $obj->code; $staticaction->label = $obj->label ? $obj->label : $obj->type_label; $staticaction->id = $obj->id; print '<td>' . $staticaction->getNomUrl(1, 34) . '</td>'; // print '<td>'.dol_trunc($obj->label,22).'</td>'; print '<td>'; if ($obj->rowid > 0) { $customerstatic->id = $obj->rowid; $customerstatic->name = $obj->sname; $customerstatic->client = $obj->client; print $customerstatic->getNomUrl(1, '', 16); } print '</td>'; $datep = $db->jdate($obj->dp); $datep2 = $db->jdate($obj->dp2); // Date print '<td width="100" align="right">' . dol_print_date($datep, 'day') . ' '; $late = 0; if ($obj->percent == 0 && $datep && $datep < time()) { $late = 1; } if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) { $late = 1; } if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) { $late = 1; } if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) { $late = 1; } if ($late) { print img_warning($langs->trans("Late")); } print "</td>"; // Statut print "<td align=\"right\" width=\"14\">" . $staticaction->LibStatut($obj->percent, 3) . "</td>\n"; print "</tr>\n"; $i++; } print "</table><br>"; $db->free($resql); } else { dol_print_error($db); } }
//print "<td>".$langs->trans("JournalNum")."</td>"; print '<td>' . $langs->trans('Date') . '</td><td>' . $langs->trans('Piece') . ' (' . $langs->trans('InvoiceRef') . ')</td>'; print '<td>' . $langs->trans('Account') . '</td>'; print '<td>' . $langs->trans('Type') . '</td><td align="right">' . $langs->trans('Debit') . '</td><td align="right">' . $langs->trans('Credit') . '</td>'; print "</tr>\n"; $var = true; $invoicestatic = new Facture($db); $companystatic = new Client($db); foreach ($tabfac as $key => $val) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['client']; $lines = array(array('var' => $tabttc[$key], 'label' => $langs->trans('ThirdParty') . ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')', 'nomtcheck' => true, 'inv' => true), array('var' => $tabht[$key], 'label' => $langs->trans('Products')), array('var' => $tabtva[$key], 'label' => $langs->trans('VAT')), array('var' => $tablocaltax1[$key], 'label' => $langs->transcountry('LT1', $mysoc->country_code)), array('var' => $tablocaltax2[$key], 'label' => $langs->transcountry('LT2', $mysoc->country_code))); foreach ($lines as $line) { foreach ($line['var'] as $k => $mt) { if (isset($line['nomtcheck']) || $mt) { print "<tr " . $bc[$var] . " >"; //print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>"; print "<td>" . dol_print_date($val["date"]) . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>" . $k . "</td><td>" . $line['label'] . "</td>"; if (isset($line['inv'])) { print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td align="right">' . ($mt < 0 ? price(-$mt) : '') . "</td>"; } else { print '<td align="right">' . ($mt < 0 ? price(-$mt) : '') . "</td>"; print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $this->max = $max; $thirdpartystatic = new Client($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom as name, s.rowid as socid"; $sql .= ", s.code_client"; $sql .= ", s.client"; $sql .= ", s.code_fournisseur"; $sql .= ", s.fournisseur"; $sql .= ", s.logo"; $sql .= ", s.fk_stcomm, s.datec, s.tms, s.status"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (2, 3)"; $sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id; } $sql .= " ORDER BY s.tms DESC"; $sql .= $db->plimit($max, 0); dol_syslog(get_class($this) . "::loadBox", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $line = 0; while ($line < $num) { $objp = $db->fetch_object($resql); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->client = $objp->client; $thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->logo = $objp->logo; $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => str_replace('img ', 'img height="14" ', $thirdpartystatic->LibProspCommStatut($objp->fk_stcomm, 3))); $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3)); $line++; } if ($num == 0) { $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProspects")); } $db->free($resql); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
print "</tr>\n"; $i = 0; $var = true; while ($i < min($num, $conf->liste_limit)) { $obj = $db->fetch_object($resql); $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td>'; $prospectstatic->id = $obj->socid; $prospectstatic->name = $obj->name; $prospectstatic->status = $obj->status; $prospectstatic->code_client = $obj->code_client; $prospectstatic->client = $obj->client; $prospectstatic->fk_prospectlevel = $obj->fk_prospectlevel; $prospectstatic->name_alias = $obj->name_alias; print $prospectstatic->getNomUrl(1, 'prospect'); print '</td>'; print "<td>" . $obj->zip . "</td>"; print "<td>" . $obj->town . "</td>"; print '<td align="center">' . $obj->departement . '</td>'; // Creation date print '<td align="center">' . dol_print_date($db->jdate($obj->datec)) . '</td>'; // Level print '<td align="center">'; print $prospectstatic->getLibProspLevel(); print "</td>"; // Statut print '<td align="center" class="nowrap">'; print $prospectstatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); print "</td>"; print '<td align="center" class="nowrap">';