function addetatpaiement($nextid, $moi, $année) { global $db; global $db1; $usrid = $_SESSION['userid']; $avance_salaire = 0; $retour = true; $fullquery = "select * from salarie"; if (!$db->Query($fullquery)) { $db->Kill($db->Error()); } while (!$db->EndOfSeek()) { $row = $db->Row(); if (!$db1->Query(" SELECT sum(montant) as avance FROM avance_salaire WHERE MONTH(date)= {$moi} and YEAR( date )= {$année} and id_salarie = " . $row->id)) { $db1->Kill($db1->Error()); } if ($db1->RowCount() > 0) { $array = $db1->RowArray(); $avance_salaire = $array['avance']; } addsalaire($row->id, $row->salaire_de_base, $row->nouveau_salaire, $row->taux_anciennete, $row->INDEM, $avance_salaire, $row->numero_compte, $nextid); } return $retour; }
<?php if (tp('verif') == 1) { global $db; global $db1; global $db3; $nextid = getnextidtable('salaire'); $id_etat_paiement = tp('etat'); model::load('salarie', 'addsalaire'); if (!addsalaire(tp('id'), tp('salaire_base'), tp('nouveau_salaire'), tp('taux'), tp('indem'), tp('redevance'), tp('numero_compte'), $id_etat_paiement)) { exit("0"); } else { if (!editavance(tp('id'), tp('idredevance'), tp('redevance'))) { exit("2"); } else { addetatsalaire($id_etat_paiement); $model_name = "table_b_paie"; require_once LIB_REP . "/excel/template/" . $model_name . "_xls.php"; creat_document($model_name, $nextid, $id_etat_paiement, tp('id'), tp('taux')); $id_fiche_pdf = $db->QuerySingleValue0("select fiche_bulletin from salaire where id = {$nextid}"); exit("4#{$id_fiche_pdf}"); } } //Creat Bulletin de paie } else { view::load('salarie', 'detailsal'); } ?>