print $invoice->getNomUrl(1); print "</td>\n"; // Third party print '<td>'; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; print $thirdpartystatic->getNomUrl(1); print '</td>'; // Expected to pay print '<td align="right">' . price($objp->total_ttc) . '</td>'; // Amount payed print '<td align="right">' . price($objp->amount) . '</td>'; // Remain to pay print '<td align="right">' . price($remaintopay) . '</td>'; // Status print '<td align="right">' . $invoice->getLibStatut(5, $alreadypayed) . '</td>'; print "</tr>\n"; if ($objp->paye == 1) { $disable_delete = 1; } $total = $total + $objp->amount; $i++; } } $var = !$var; print "</table>\n"; $db->free($resql); } else { dol_print_error($db); } print '</div>';
} $optionsav = ""; $newinvoice_static = new Facture($db); foreach ($facids as $key => $valarray) { $newinvoice_static->id = $key; $newinvoice_static->ref = $valarray['ref']; $newinvoice_static->statut = $valarray['status']; $newinvoice_static->type = $valarray['type']; $newinvoice_static->paye = $valarray['paye']; $optionsav .= '<option value="' . $key . '"'; if ($key == GETPOST('fac_avoir')) { $optionsav .= ' selected'; } $optionsav .= '>'; $optionsav .= $newinvoice_static->ref; $optionsav .= ' (' . $newinvoice_static->getLibStatut(1, $valarray['paymentornot']) . ')'; $optionsav .= '</option>'; } print '<tr><td valign="top" class="fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">'; print '<div class="tagtable">' . "\n"; // Standard invoice print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; $tmp = '<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '> '; $desc = $form->textwithpicto($tmp . $langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print $desc; print '</div></div>'; if (empty($origin) || ($origin == 'propal' || $origin == 'commande') && !empty($originid)) { // Deposit print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; print '<script type="text/javascript" language="javascript">
$fac = new Facture($db); $ret=$fac->fetch($objf->facid); if ($ret < 0) { print $fac->error."<br>"; continue; } $totalpaye = $fac->getSommePaiement(); $var=!$var; print "<tr $bc[$var]>"; print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n"; print "<td><a href=\"../compta/facture.php?facid=$fac->id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n"; print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>'; print '<td align="right">'.price($fac->total_ttc)."</td>\n"; $solde = $solde + $fac->total_ttc; print '<td align="right"> </td>'; print '<td align="right">'.price($solde)."</td>\n"; // Auteur print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objf->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'</a></td>'; print "</tr>\n"; // Paiements $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,"; $sql.= " p.fk_user_creat, u.login, u.rowid as userid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf,";
print '<tr ' . $bc[$var] . '><td>'; print $invoicestatic->getNomUrl(1, 'withdraw'); print '</td>'; print '<td>'; $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print '</td>'; print '<td align="right">'; print price($obj->amount); print '</td>'; print '<td align="right">'; print dol_print_date($db->jdate($obj->date_demande), 'day'); print '</td>'; print '<td align="right">'; print $invoicestatic->getLibStatut(3, $alreadypayed); print '</td>'; print '</tr>'; $i++; } } else { print '<tr ' . $bc[false] . '><td colspan="2">' . $langs->trans("NoInvoiceToWithdraw") . '</td></tr>'; } print "</table><br>"; } else { dol_print_error($db); } print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; /* * Withdraw receipts */
$facids=$facturestatic->list_qualified_avoir_invoices($soc->id); if ($facids < 0) { dol_print_error($db,$facturestatic); exit; } $optionsav=""; foreach ($facids as $key => $value) { $newinvoice=new Facture($db); $newinvoice->fetch($key); $optionsav.='<option value="'.$key.'"'; if ($key == $_POST['fac_avoir']) $optionsav.=' selected="selected"'; $optionsav.='>'; $optionsav.=$newinvoice->ref; $optionsav.=' ('.$newinvoice->getLibStatut(1,$value).')'; $optionsav.='</option>'; } print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">'; print '<table class="nobordernopadding">'."\n"; // Standard invoice print '<tr height="18"><td width="16px" valign="middle">'; print '<input type="radio" name="type" value="0"'.(GETPOST('type')==0?' checked="true"':'').'>'; print '</td><td valign="middle">'; $desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1); print $desc; print '</td></tr>'."\n"; // Deposit
print '<tr class="liste_titre">'; print '<td>' . $langs->trans("Invoice") . '</td><td>' . $langs->trans("ThirdParty") . '</td><td align="right">' . $langs->trans("Amount") . '</td><td align="right">' . $langs->trans("Status") . '</td>'; print '</tr>'; $var = True; $total = 0; $var = false; while ($i < min($num, $conf->liste_limit)) { $obj = $db->fetch_object($result); print "<tr " . $bc[$var] . "><td>"; print '<a href="' . DOL_URL_ROOT . '/compta/facture.php?facid=' . $obj->facid . '">'; print img_object($langs->trans("ShowBill"), "bill"); print '</a> '; print '<a href="' . DOL_URL_ROOT . '/compta/facture.php?facid=' . $obj->facid . '">' . $obj->ref . "</a></td>\n"; print '<td><a href="' . DOL_URL_ROOT . '/comm/card.php?socid=' . $obj->socid . '">'; print img_object($langs->trans("ShowCompany"), "company") . ' ' . $obj->name . "</a></td>\n"; print '<td align="right">' . price($obj->total_ttc) . "</td>\n"; print '<td align="right">'; $invoicestatic->fetch($obj->facid); print $invoicestatic->getLibStatut(5); print "</td>\n"; print "</tr>\n"; $i++; } print "</table>"; $db->free($result); } else { dol_print_error($db); } } llxFooter(); $db->close();
if ($resql) { $var = true; $num = $db->num_rows($resql); // Boucle sur chaque facture for ($i = 0; $i < $num; $i++) { $objf = $db->fetch_object($resql); $fac = new Facture($db); $ret = $fac->fetch($objf->facid); if ($ret < 0) { print $fac->error . "<br>"; continue; } $totalpaye = $fac->getSommePaiement(); $userstatic->id = $objf->userid; $userstatic->login = $objf->login; $TData[] = array('date' => $fac->date, 'link' => $fac->getNomUrl(1), 'status' => $fac->getLibStatut(2, $totalpaye), 'amount' => $fac->total_ttc, 'author' => $userstatic->getLoginUrl(1)); $TDataSort[] = $fac->date; // Paiements $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,"; $sql .= " p.fk_user_creat, u.login, u.rowid as userid"; $sql .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf,"; $sql .= " " . MAIN_DB_PREFIX . "paiement as p"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u ON p.fk_user_creat = u.rowid"; $sql .= " WHERE pf.fk_paiement = p.rowid"; $sql .= " AND p.entity = " . $conf->entity; $sql .= " AND pf.fk_facture = " . $fac->id; $sql .= " ORDER BY p.datep ASC"; $resqlp = $db->query($sql); if ($resqlp) { $nump = $db->num_rows($resqlp); $j = 0;