Ejemplo n.º 1
0
        if ($result > 0) {
            $url = $_SERVER['PHP_SELF'] . "?socid=" . $soc->id;
            header('Location: ' . $url);
            exit;
        } else {
            setEventMessage($account->error, 'errors');
        }
    } else {
        setEventMessage($account->error, 'errors');
    }
}
/*
 *	View
 */
$form = new Form($db);
$prelevement = new BonPrelevement($db);
llxHeader();
$head = societe_prepare_head2($soc);
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
$account = new CompanyBankAccount($db);
if (!$id) {
    $account->fetch(0, $soc->id);
} else {
    $account->fetch($id);
}
if (empty($account->socid)) {
    $account->socid = $soc->id;
}
/* ************************************************************************** */
/*                                                                            */
/* Visu et edition                                                            */
Ejemplo n.º 2
0
            while ($i < $num)
            {
                $obj = $db->fetch_object($result);
                $var=!$var;

                print "<tr $bc[$var]>";

                print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";

                print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";

                print '<td align="center">'.price($obj->amount).'</td>';

                print '<td align="center">';
                $withdrawreceipt=new BonPrelevement($db);
                $withdrawreceipt->id=$obj->fk_prelevement_bons;
                $withdrawreceipt->ref=$obj->ref;
                print $withdrawreceipt->getNomUrl(1);
                print "</td>\n";

                print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';

                print '<td>&nbsp;</td>';
                print '<td>&nbsp;</td>';

                print "</tr>\n";
                $i++;
            }

            $db->free($result);
Ejemplo n.º 3
0
    if ($result < 0) {
        $mesg = '<div class="error">' . $bprev->error . '</div>';
    }
    if ($result == 0) {
        $mesg = '<div class="error">' . $langs->trans("NoInvoiceCouldBeWithdrawed") . '</div>';
        foreach ($bprev->invoice_in_error as $key => $val) {
            $mesg .= $val . "<br>\n";
        }
    }
}
/*
 * View
 */
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$bprev = new BonPrelevement($db);
llxHeader('', $langs->trans("NewStandingOrder"));
if (prelevement_check_config() < 0) {
    $langs->load("errors");
    print '<div class="error">';
    print $langs->trans("ErrorModuleSetupNotComplete");
    print '</div>';
}
/*$h=0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
$head[$h][1] = $langs->trans("NewStandingOrder");
$head[$h][2] = 'payment';
$hselected = 'payment';
$h++;

dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
 /**
  *	Create a withdraw
  *  TODO delete params banque and agence when not necesary
  *
  *	@param 	int		$banque		dolibarr mysoc bank
  *	@param	int		$agence		dolibarr mysoc bank office (guichet)
  *	@param	string	$mode		real=do action, simu=test only
  *	@return	int					<0 if KO, nbre of invoice withdrawed if OK
  */
 function Create($banque = 0, $agence = 0, $mode = 'real')
 {
     global $conf, $langs;
     dol_syslog(get_class($this) . "::Create banque={$banque} agence={$agence}");
     require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
     require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
     $error = 0;
     $datetimeprev = time();
     $month = strftime("%m", $datetimeprev);
     $year = strftime("%Y", $datetimeprev);
     $puser = new User($this->db, $conf->global->PRELEVEMENT_USER);
     /*
      * Read invoices
      */
     $factures = array();
     $factures_prev = array();
     $factures_result = array();
     if (!$error) {
         $sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
         $sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib";
         $sql .= ", pfd.amount";
         $sql .= ", s.nom";
         $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
         $sql .= ", " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "prelevement_facture_demande as pfd";
         //if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr";
         $sql .= " WHERE f.rowid = pfd.fk_facture";
         $sql .= " AND f.entity = " . $conf->entity;
         $sql .= " AND s.rowid = f.fk_soc";
         //if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
         $sql .= " AND f.fk_statut = 1";
         $sql .= " AND f.paye = 0";
         $sql .= " AND pfd.traite = 0";
         $sql .= " AND f.total_ttc > 0";
         //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
         //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
         dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $num = $this->db->num_rows($resql);
             $i = 0;
             while ($i < $num) {
                 $row = $this->db->fetch_row($resql);
                 $factures[$i] = $row;
                 // All fields
                 $i++;
             }
             $this->db->free($resql);
             dol_syslog($i . " invoices to withdraw");
         } else {
             $error = 1;
             dol_syslog("Erreur -1");
             dol_syslog($this->db->error());
         }
     }
     if (!$error) {
         require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
         $soc = new Societe($this->db);
         // Check RIB
         $i = 0;
         dol_syslog("Start RIB check");
         if (count($factures) > 0) {
             foreach ($factures as $key => $fac) {
                 $fact = new Facture($this->db);
                 if ($fact->fetch($fac[0]) >= 0) {
                     if ($soc->fetch($fact->socid) >= 0) {
                         $bac = new CompanyBankAccount($this->db);
                         $bac->fetch(0, $soc->id);
                         if ($bac->verif() >= 1) {
                             $factures_prev[$i] = $fac;
                             /* second tableau necessaire pour BonPrelevement */
                             $factures_prev_id[$i] = $fac[0];
                             $i++;
                         } else {
                             dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() " . $fact->socid . " " . $soc->nom, LOG_ERR);
                             $facture_errors[$fac[0]] = "Error on default bank number RIB/IBAN for thirdparty reported by function verif() " . $fact->socid . " " . $soc->nom;
                         }
                     } else {
                         dol_syslog("Failed to read company", LOG_ERR);
                     }
                 } else {
                     dol_syslog("Failed to read invoice", LOG_ERR);
                 }
             }
         } else {
             dol_syslog("No invoice to process");
         }
     }
     $ok = 0;
     // Withdraw invoices in factures_prev array
     $out = count($factures_prev) . " invoices will be withdrawn.";
     //print $out."\n";
     dol_syslog($out);
     if (count($factures_prev) > 0) {
         if ($mode == 'real') {
             $ok = 1;
         } else {
             print $langs->trans("ModeWarning");
             //"Option for real mode was not set, we stop after this simulation\n";
         }
     }
     if ($ok) {
         /*
          * We are in real mode.
          * We create withdraw receipt and build withdraw into disk
          */
         $this->db->begin();
         $now = dol_now();
         /*
          * Traitements
          */
         if (!$error) {
             $ref = "T" . substr($year, -2) . $month;
             $sql = "SELECT count(*)";
             $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
             $sql .= " WHERE ref LIKE '" . $ref . "%'";
             $sql .= " AND entity = " . $conf->entity;
             dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG);
             $resql = $this->db->query($sql);
             if ($resql) {
                 $row = $this->db->fetch_row($resql);
             } else {
                 $error++;
                 dol_syslog("Erreur recherche reference");
             }
             $ref = $ref . substr("00" . ($row[0] + 1), -2);
             $filebonprev = $ref;
             // Create withdraw receipt in database
             $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
             $sql .= " ref, entity, datec";
             $sql .= ") VALUES (";
             $sql .= "'" . $this->db->escape($ref) . "'";
             $sql .= ", " . $conf->entity;
             $sql .= ", '" . $this->db->idate($now) . "'";
             $sql .= ")";
             dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG);
             $resql = $this->db->query($sql);
             if ($resql) {
                 $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
                 $dir = $conf->prelevement->dir_output . '/receipts';
                 $file = $filebonprev;
                 if (!is_dir($dir)) {
                     dol_mkdir($dir);
                 }
                 $bonprev = new BonPrelevement($this->db, $dir . "/" . $file);
                 $bonprev->id = $prev_id;
             } else {
                 $error++;
                 dol_syslog("Erreur creation du bon de prelevement");
             }
         }
         /*
          * Create withdrawal receipt
          */
         if (!$error) {
             if (count($factures_prev) > 0) {
                 foreach ($factures_prev as $fac) {
                     // Fetch invoice
                     $fact = new Facture($this->db);
                     $fact->fetch($fac[0]);
                     /*
                      * Add standing order
                      *
                      *
                      * $fac[3] : banque
                      * $fac[4] : guichet
                      * $fac[5] : number
                      * $fac[6] : cle rib
                      * $fac[7] : amount
                      * $fac[8] : client nom
                      * $fac[2] : client id
                      */
                     $ri = $bonprev->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]);
                     if ($ri != 0) {
                         $error++;
                     }
                     /*
                      * Update orders
                      *
                      */
                     $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_facture_demande";
                     $sql .= " SET traite = 1";
                     $sql .= ", date_traite = '" . $this->db->idate($now) . "'";
                     $sql .= ", fk_prelevement_bons = " . $prev_id;
                     $sql .= " WHERE rowid = " . $fac[1];
                     dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG);
                     $resql = $this->db->query($sql);
                     if (!$resql) {
                         $error++;
                         dol_syslog("Erreur mise a jour des demandes");
                         dol_syslog($this->db->error());
                     }
                 }
             }
         }
         if (!$error) {
             /*
              * Withdraw receipt
              */
             dol_syslog("Debut prelevement - Nombre de factures " . count($factures_prev));
             if (count($factures_prev) > 0) {
                 $bonprev->date_echeance = $datetimeprev;
                 $bonprev->reference_remise = $ref;
                 $bonprev->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR;
                 $bonprev->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE;
                 $bonprev->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE;
                 $bonprev->emetteur_code_guichet = $conf->global->PRELEVEMENT_CODE_GUICHET;
                 $bonprev->emetteur_numero_compte = $conf->global->PRELEVEMENT_NUMERO_COMPTE;
                 $bonprev->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY;
                 $bonprev->emetteur_iban = $conf->global->PRELEVEMENT_IBAN;
                 $bonprev->emetteur_bic = $conf->global->PRELEVEMENT_BIC;
                 $bonprev->emetteur_ics = $conf->global->PRELEVEMENT_ICS;
                 // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
                 $bonprev->factures = $factures_prev_id;
                 //Build file
                 $bonprev->generate();
             }
             dol_syslog($filebonprev);
             dol_syslog("Fin prelevement");
         }
         /*
          * Update total
          */
         $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
         $sql .= " SET amount = " . price2num($bonprev->total);
         $sql .= " WHERE rowid = " . $prev_id;
         $sql .= " AND entity = " . $conf->entity;
         dol_syslog(get_class($this) . "::Create sql=" . $sql, LOG_DEBUG);
         $resql = $this->db->query($sql);
         if (!$resql) {
             $error++;
             dol_syslog("Erreur mise a jour du total - {$sql}");
         }
         /*
          * Rollback or Commit
          */
         if (!$error) {
             $this->db->commit();
         } else {
             $this->db->rollback();
             dol_syslog("Error", LOG_ERR);
         }
         return count($factures_prev);
     } else {
         return 0;
     }
 }
Ejemplo n.º 5
0
    if (!$error) {
        $db->commit();
        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
    } else {
        $db->rollback();
        setEventMessages($langs->trans("Error"), null, 'errors');
    }
}
if ($action == "addnotif") {
    $bon = new BonPrelevement($db);
    $bon->AddNotification($db, GETPOST('user', 'int'), $action);
    header("Location: prelevement.php");
    exit;
}
if ($action == "deletenotif") {
    $bon = new BonPrelevement($db);
    $bon->DeleteNotificationById(GETPOST('notif', 'int'));
    header("Location: prelevement.php");
    exit;
}
/*
 *	View
 */
$form = new Form($db);
llxHeader('', $langs->trans("WithdrawalsSetup"));
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("WithdrawalsSetup"), $linkback, 'title_setup');
print '<br>';
print '<form method="post" action="prelevement.php?action=set">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<table class="noborder" width="100%">';
Ejemplo n.º 6
0
        if ($result > 0) {
            $url = $_SERVER['PHP_SELF'] . "?socid=" . $object->id;
            header('Location: ' . $url);
            exit;
        } else {
            setEventMessage($account->error, 'errors');
        }
    } else {
        setEventMessage($account->error, 'errors');
    }
}
/*
 *	View
 */
$form = new Form($db);
$prelevement = new BonPrelevement($db);
llxHeader();
$head = societe_prepare_head2($object);
$account = new CompanyBankAccount($db);
if (!$id) {
    $account->fetch(0, $object->id);
} else {
    $account->fetch($id);
}
if (empty($account->socid)) {
    $account->socid = $object->id;
}
if ($socid && $action == 'edit' && $user->rights->societe->creer) {
    print '<form action="rib.php?socid=' . $object->id . '" method="post">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="update">';
Ejemplo n.º 7
0
 */
/*
 * View
 */
llxHeader('', $langs->trans("CustomersStandingOrdersArea"));
if (prelevement_check_config() < 0) {
    $langs->load("errors");
    print '<div class="error">';
    print $langs->trans("ErrorModuleSetupNotComplete");
    print '</div>';
}
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$bprev = new BonPrelevement($db);
$var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("Statistics") . '</td></tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '><td>' . $langs->trans("NbOfInvoiceToWithdraw") . '</td>';
print '<td align="right">';
print '<a href="' . DOL_URL_ROOT . '/compta/prelevement/demandes.php?status=0">';
print $bprev->NbFactureAPrelever();
print '</a>';
print '</td></tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '><td>' . $langs->trans("AmountToWithdraw") . '</td>';
print '<td align="right">';
print price($bprev->SommeAPrelever(), '', '', 1, -1, -1, 'auto');
print '</td></tr></table><br>';
Ejemplo n.º 8
0
        exit;
    }
}
/*
 * View
 */
llxHeader('', $langs->trans("StandingOrder"));
$h = 0;
$head[$h][0] = DOL_URL_ROOT . '/compta/prelevement/ligne.php?id=' . $id;
$head[$h][1] = $langs->trans("Card");
$hselected = $h;
$h++;
if ($id) {
    $lipre = new LignePrelevement($db, $user);
    if ($lipre->fetch($id) == 0) {
        $bon = new BonPrelevement($db);
        $bon->fetch($lipre->bon_rowid);
        dol_fiche_head($head, $hselected, $langs->trans("StandingOrder"));
        print '<table class="border" width="100%">';
        print '<tr><td width="20%">' . $langs->trans("WithdrawalReceipt") . '</td><td>';
        print '<a href="fiche.php?id=' . $lipre->bon_rowid . '">' . $lipre->bon_ref . '</a></td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Date") . '</td><td>' . dol_print_date($bon->datec, 'day') . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Amount") . '</td><td>' . price($lipre->amount) . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Status") . '</td><td>';
        print $lipre->LibStatut($lipre->statut, 1) . '</td></tr>';
        if ($lipre->statut == 3) {
            $rej = new RejetPrelevement($db, $user);
            $resf = $rej->fetch($lipre->id);
            if ($resf == 0) {
                print '<tr><td width="20%">' . $langs->trans("RefusedReason") . '</td><td>' . $rej->motif . '</td></tr>';
                print '<tr><td width="20%">' . $langs->trans("RefusedData") . '</td><td>';
Ejemplo n.º 9
0
	}
	exit;
}


/*
 * View
 */

llxHeader('',$langs->trans("WithdrawalReceipt"));

$html = new Form($db);

if ($id)
{
	$bon = new BonPrelevement($db,"");

	if ($bon->fetch($id) == 0)
	{
		$head = prelevement_prepare_head($bon);
		dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment');

		if (GETPOST("error")!='')
		{
			print '<div class="error">'.$bon->ReadError(GETPOST("error")).'</div>';
		}

		if ($action == 'credite')
		{
			$ret=$html->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
			if ($ret == 'html') print '<br>';
Ejemplo n.º 10
0
    /**
     *  Return bank number property of thirdparty (label or rum)
     *
     *	@param	string	$mode	'label' or 'rum'
     *  @return	string			Bank number
     */
    function display_rib($mode='label')
    {
        require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
        $bac = new CompanyBankAccount($this->db);
        $bac->fetch(0,$this->id);

        if ($mode == 'label')
        {
        	return $bac->getRibLabel(true);
        }
        elseif ($mode == 'rum')
        {
        	if (empty($bac->rum))
        	{
        		$prelevement = new BonPrelevement($this->db);
        		$bac->fetch_thirdparty();
        		$bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
        	}
        	return $bac->rum;
        }

        return 'BadParameterToFunctionDisplayRib';
    }
Ejemplo n.º 11
0
}
require_once $path . "../../htdocs/master.inc.php";
require_once DOL_DOCUMENT_ROOT . "/compta/prelevement/class/bonprelevement.class.php";
require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
require_once DOL_DOCUMENT_ROOT . "/compta/paiement/class/paiement.class.php";
// Global variables
$version = DOL_VERSION;
$error = 0;
/*
 * Main
 */
@set_time_limit(0);
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
dol_syslog($script_file . " launched with arg " . join(',', $argv));
$datetimeprev = dol_now();
$month = strftime("%m", $datetimeprev);
$year = strftime("%Y", $datetimeprev);
$user = new user($db);
$user->fetch($conf->global->PRELEVEMENT_USER);
if (!isset($argv[1])) {
    // Check parameters
    print "This script check invoices with a withdrawal request and\n";
    print "then create payment and build a withdraw file.\n";
    print "Usage: " . $script_file . " simu|real\n";
    exit(-1);
}
$withdrawreceipt = new BonPrelevement($db);
$result = $withdrawreceipt->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $argv[1]);
$db->close();
exit(0);
Ejemplo n.º 12
0
 /**
  * testBonPrevelementCreate
  *
  * @return	int
  */
 public function testBonPrelevementCreate()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     // TODO
     // Create invoice
     // Create payment with mode withdraw
     // Ask withdraw request
     // Create withdraw record and generate SEPA file
     $localobject = new BonPrelevement($this->savdb);
     //$localobject->date_solde=dol_now();
     $result = $localobject->Create(0, 0, 'simu');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertEquals($result, 0);
     // Test SEPA file
     return $result;
 }
Ejemplo n.º 13
0
    }
}
/*
 * View
 */
$invoicestatic = new Facture($db);
llxHeader('', $langs->trans("StandingOrder"));
$h = 0;
$head[$h][0] = DOL_URL_ROOT . '/compta/prelevement/ligne.php?id=' . $id;
$head[$h][1] = $langs->trans("Card");
$hselected = $h;
$h++;
if ($id) {
    $lipre = new LignePrelevement($db, $user);
    if ($lipre->fetch($id) == 0) {
        $bon = new BonPrelevement($db);
        $bon->fetch($lipre->bon_rowid);
        dol_fiche_head($head, $hselected, $langs->trans("StandingOrder"));
        print '<table class="border" width="100%">';
        print '<tr><td width="20%">' . $langs->trans("WithdrawalsReceipts") . '</td><td>';
        print $bon->getNomUrl(1) . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Date") . '</td><td>' . dol_print_date($bon->datec, 'day') . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Amount") . '</td><td>' . price($lipre->amount) . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Status") . '</td><td>' . $lipre->LibStatut($lipre->statut, 1) . '</td></tr>';
        if ($lipre->statut == 3) {
            $rej = new RejetPrelevement($db, $user);
            $resf = $rej->fetch($lipre->id);
            if ($resf == 0) {
                print '<tr><td width="20%">' . $langs->trans("RefusedReason") . '</td><td>' . $rej->motif . '</td></tr>';
                print '<tr><td width="20%">' . $langs->trans("RefusedData") . '</td><td>';
                if ($rej->date_rejet == 0) {
Ejemplo n.º 14
0
/*
 * View
 */
llxHeader('', $langs->trans("CustomersStandingOrdersArea"));
if (prelevement_check_config() < 0) {
    $langs->load("errors");
    print '<div class="error">';
    print $langs->trans("ErrorModuleSetupNotComplete");
    print '</div>';
}
print_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$bprev = new BonPrelevement($db);
$var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("Statistics") . '</td></tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '><td>' . $langs->trans("NbOfInvoiceToWithdraw") . '</td>';
print '<td align="right">';
print '<a href="' . DOL_URL_ROOT . '/compta/prelevement/demandes.php?status=0">';
print $bprev->NbFactureAPrelever();
print '</a>';
print '</td></tr>';
$var = !$var;
print '<tr class="liste_total"><td>' . $langs->trans("AmountToWithdraw") . '</td>';
print '<td align="right">';
print price($bprev->SommeAPrelever());
print '</td></tr></table><br>';
Ejemplo n.º 15
0
$langs->load("banks");
$langs->load("categories");
$langs->load("withdrawals");
// Security check
if ($user->societe_id > 0) {
    accessforbidden();
}
// Get supervariables
$prev_id = GETPOST('id', 'int');
$page = GETPOST('page', 'int');
/*
 * View
 */
llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id) {
    $bon = new BonPrelevement($db, "");
    if ($bon->fetch($prev_id) == 0) {
        $head = prelevement_prepare_head($bon);
        dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment');
        print '<table class="border" width="100%">';
        print '<tr><td width="20%">' . $langs->trans("Ref") . '</td><td>' . $bon->getNomUrl(1) . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Date") . '</td><td>' . dol_print_date($bon->datec, 'day') . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Amount") . '</td><td>' . price($bon->amount) . '</td></tr>';
        // Status
        print '<tr><td width="20%">' . $langs->trans('Status') . '</td>';
        print '<td>' . $bon->getLibStatut(1) . '</td>';
        print '</tr>';
        if ($bon->date_trans != 0) {
            $muser = new User($db);
            $muser->fetch($bon->user_trans);
            print '<tr><td width="20%">' . $langs->trans("TransData") . '</td><td>';
Ejemplo n.º 16
0
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT . "/compta/prelevement/class/bon-prelevement.class.php";
$langs->load("bills");
$langs->load("categories");
// Security check
$socid = 0;
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'prelevement', $id);
llxHeader('', 'Bon de prelevement');
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    $object = new BonPrelevement($db, "");
    if ($object->fetch($id) == 0) {
        $head = prelevement_prepare_head($object);
        dol_fiche_head($head, 'preview', 'Prelevement : ' . $object->ref);
        print '<table class="border" width="100%">';
        print '<tr><td width="20%">' . $langs->trans("Ref") . '</td><td>' . $object->ref . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("Amount") . '</td><td>' . price($object->amount) . '</td></tr>';
        print '<tr><td width="20%">' . $langs->trans("File") . '</td><td>';
        $relativepath = 'bon/' . $object->ref;
        print '<a href="' . DOL_URL_ROOT . '/document.php?type=text/plain&amp;modulepart=prelevement&amp;file=' . urlencode($relativepath) . '">' . $object->ref . '</a>';
        print '</td></tr>';
        print '</table><br>';
        $fileimage = $conf->prelevement->dir_output . '/receipts/' . $object->ref . '.ps.png.0';
        $fileps = $conf->prelevement->dir_output . '/receipts/' . $object->ref . '.ps';
        // Conversion du PDF en image png si fichier png non existant
        if (!file_exists($fileimage)) {
Ejemplo n.º 17
0
$langs->load("categories");
$langs->load("widthdrawals");
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
// Get supervariables
$page = GETPOST('page', 'int');
$sortorder = GETPOST('sortorder', 'alpha') == "" ? "DESC" : GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha') == "" ? "p.datec" : GETPOST('sortfield', 'alpha');
$statut = GETPOST('statut', 'int');
$search_line = GETPOST('search_ligne', 'int');
llxHeader('', $langs->trans("WithdrawalsReceipts"));
$bon = new BonPrelevement($db, "");
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
 * Mode Liste
 *
 */
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql .= ", p.datec";
$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
$sql .= " WHERE p.entity = " . $conf->entity;
$sql .= " ORDER BY {$sortfield} {$sortorder} ";
Ejemplo n.º 18
0
	Header("Location: prelevement.php");
	exit;
}

if ($_GET["action"] == "addnotif")
{
	$bon = new BonPrelevement($db);
	$bon->AddNotification($db,$_POST["user"],$_POST["action"]);

	Header("Location: prelevement.php");
	exit;
}

if ($_GET["action"] == "deletenotif")
{
	$bon = new BonPrelevement($db);
	$bon->DeleteNotificationById($_GET["notif"]);

	Header("Location: prelevement.php");
	exit;
}

/*
 *	View
 */

$html=new Form($db);

llxHeader('',$langs->trans("WithdrawalsSetup"));

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';