Example #1
0
 */
$morequerystring = '';
$listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday');
foreach ($listofparams as $param) {
    if (GETPOST($param) != '') {
        $morequerystring .= ($morequerystring ? '&' : '') . $param . '=' . GETPOST($param);
    }
}
llxHeader('', '', '', '', 0, 0, '', '', $morequerystring);
$form = new Form($db);
$company_static = new Societe($db);
$invoice_customer = new Facture($db);
$invoice_supplier = new FactureFournisseur($db);
$product_static = new Product($db);
$payment_static = new Paiement($db);
$paymentfourn_static = new PaiementFourn($db);
//print load_fiche_titre($langs->trans("VAT"),"");
//$fsearch.='<br>';
$fsearch .= '  <input type="hidden" name="year" value="' . $year . '">';
$fsearch .= '  <input type="hidden" name="modetax" value="' . $modetax . '">';
//$fsearch.='  '.$langs->trans("SalesTurnoverMinimum").': ';
//$fsearch.='  <input type="text" name="min" value="'.$min.'">';
// Affiche en-tete du rapport
if ($modetax == 1) {
    $nom = $langs->trans("VATReportByQuartersInDueDebtMode");
    $calcmode = $langs->trans("CalcModeVATDebt");
    $calcmode .= '<br>(' . $langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT . '/admin/taxes.php') . ')';
    $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
    $prevyear = $year_start;
    $prevquarter = $q;
    if ($prevquarter > 1) {
if (!isset($argv[3]) || !$argv[3]) {
    print "Usage: " . $script_file . " bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
    exit(-1);
}
$bankref = $argv[1];
$num = $argv[2];
$model = $argv[3];
$newlangid = 'en_EN';
// To force a new lang id
$invoicestatic = new Facture($db);
$invoicesupplierstatic = new FactureFournisseur($db);
$societestatic = new Societe($db);
$chargestatic = new ChargeSociales($db);
$memberstatic = new Adherent($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$paymentsocialcontributionstatic = new PaymentSocialContribution($db);
$paymentvatstatic = new Tva($db);
$bankstatic = new Account($db);
$banklinestatic = new AccountLine($db);
// Parse parameters
foreach ($argv as $key => $value) {
    $found = false;
    // Define options
    if (preg_match('/^lang=/i', $value)) {
        $found = true;
        $valarray = explode('=', $value);
        $newlangid = $valarray[1];
        print 'Use language ' . $newlangid . ".\n";
    }
}
Example #3
0
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) {
    $accline = new AccountLine($db);
    $result = $accline->fetch(GETPOST("rowid"));
    $result = $accline->delete();
}
/*
 * View
 */
llxHeader('', $langs->trans("FinancialAccount") . '-' . $langs->trans("Transactions"));
$societestatic = new Societe($db);
$userstatic = new User($db);
$chargestatic = new ChargeSociales($db);
$loanstatic = new Loan($db);
$memberstatic = new Adherent($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db);
$donstatic = new Don($db);
$expensereportstatic = new ExpenseReport($db);
$bankstatic = new Account($db);
$banklinestatic = new AccountLine($db);
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    if ($vline) {
        $viewline = $vline;
    } else {
        $viewline = empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? 20 : $conf->global->MAIN_SIZE_LISTE_LIMIT;
    }
    $result = $object->fetch($id, $ref);
    // Chargement des categories bancaires dans $options
Example #4
0
 *	\brief      Tab to show a payment of a supplier invoice
 *	\remarks	Fichier presque identique a compta/paiement/card.php
 */
require '../../main.inc.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php';
$langs->load('bills');
$langs->load('banks');
$langs->load('companies');
$langs->load("suppliers");
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$object = new PaiementFourn($db);
/*
 * Actions
 */
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer) {
    $db->begin();
    $object->fetch($id);
    $result = $object->update_note(GETPOST('note'));
    if ($result > 0) {
        $db->commit();
        $action = '';
    } else {
        setEventMessage($object->error, 'errors');
        $db->rollback();
    }
}
Example #5
0
 *	\brief      Tab to show a payment of a supplier invoice
 *	\remarks	Fichier presque identique a compta/paiement/fiche.php
 */
require '../../main.inc.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
$langs->load('bills');
$langs->load('banks');
$langs->load('companies');
$langs->load("suppliers");
$mesg = '';
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$object = new PaiementFourn($db);
/*
 * Actions
 */
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer) {
    $db->begin();
    $object->fetch($id);
    $result = $object->update_note(GETPOST('note'));
    if ($result > 0) {
        $db->commit();
        $action = '';
    } else {
        $mesg = '<div class="error">' . $object->error . '</div>';
        $db->rollback();
    }
}
Example #6
0
         setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), 'errors');
         $error++;
     }
 }
 if ($total == 0) {
     setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('PaymentAmount')), 'errors');
     $error++;
 }
 if (empty($datepaye)) {
     setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
     $error++;
 }
 if (!$error) {
     $db->begin();
     // Creation de la ligne paiement
     $paiement = new PaiementFourn($db);
     $paiement->datepaye = $datepaye;
     $paiement->amounts = $amounts;
     // Array of amounts
     $paiement->paiementid = $_POST['paiementid'];
     $paiement->num_paiement = $_POST['num_paiement'];
     $paiement->note = $_POST['comment'];
     if (!$error) {
         $paiement_id = $paiement->create($user, GETPOST('closepaidinvoices') == 'on' ? 1 : 0);
         if ($paiement_id < 0) {
             setEventMessage($paiement->error, 'errors');
             $error++;
         }
     }
     if (!$error) {
         $result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $_POST['accountid'], '', '');
Example #7
0
     }
 } elseif ($action == 'setdate_lim_reglement' && $user->rights->fournisseur->facture->creer) {
     $object->fetch($id);
     $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
     if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
         $object->date_echeance = $object->date;
         setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
     }
     $result = $object->update($user);
     if ($result < 0) {
         dol_print_error($db, $object->error);
     }
 } elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) {
     $object->fetch($id);
     if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) {
         $paiementfourn = new PaiementFourn($db);
         $result = $paiementfourn->fetch(GETPOST('paiement_id'));
         if ($result > 0) {
             $result = $paiementfourn->delete();
         }
         // If fetch ok and found
         if ($result < 0) {
             setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors');
         }
     }
 } elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) {
     $error = 0;
     $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
     $datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
     if (GETPOST('socid', 'int') < 1) {
         setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors');
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/**
 *   	\file       htdocs/fourn/paiement/info.php
 *		\ingroup    facture
 *		\brief      Onglet info d'un paiement fournisseur
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php';
$langs->load("bills");
$langs->load("suppliers");
$langs->load("companies");
$paiement = new PaiementFourn($db);
$paiement->fetch($_GET["id"], $user);
$paiement->info($_GET["id"]);
/*
 * View
 */
llxHeader();
$head = payment_supplier_prepare_head($paiement);
dol_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment');
print '<table width="100%"><tr><td>';
dol_print_object_info($paiement);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
Example #9
0
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
$sql .= " WHERE ba.rowid=" . $id_bank_account;
if (!empty($conf->multicompany->enabled)) {
    $sql .= " AND ba.entity = " . $conf->entity;
}
if ($date_start && $date_end) {
    $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
}
$sql .= " ORDER BY b.datev";
$object = new Account($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$societestatic = new Societe($db);
$userstatic = new User($db);
$chargestatic = new ChargeSociales($db);
$paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db);
// Get code of finance journal
$bank_code_journal = new Account($db);
$result = $bank_code_journal->fetch($id_bank_account);
$journal = $bank_code_journal->accountancy_journal;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
    $num = $db->num_rows($result);
    // Variables
Example #10
0
 *		\ingroup    facture
 *		\brief      Onglet info d'un paiement fournisseur
 */
require "../../main.inc.php";
require_once DOL_DOCUMENT_ROOT . "/core/lib/functions2.lib.php";
require_once DOL_DOCUMENT_ROOT . "/fourn/class/paiementfourn.class.php";
$langs->load("bills");
$langs->load("suppliers");
$langs->load("companies");
/*
 * View
 */
llxHeader();
$h = 0;
$head[$h][0] = DOL_URL_ROOT . '/fourn/paiement/fiche.php?id=' . $_GET["id"];
$head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT . '/fourn/paiement/info.php?id=' . $_GET["id"];
$head[$h][1] = $langs->trans("Info");
$hselected = $h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("SupplierPayment"), 0, 'payment');
$paiement = new PaiementFourn($db);
$paiement->fetch($_GET["id"], $user);
$paiement->info($_GET["id"]);
print '<table width="100%"><tr><td>';
dol_print_object_info($paiement);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
Example #11
0
$h=0;

$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$_GET['id'];
$head[$h][1] = $langs->trans('Card');
$hselected = $h;
$h++;

$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$_GET['id'];
$head[$h][1] = $langs->trans('Info');
$h++;


dol_fiche_head($head, $hselected, $langs->trans('SupplierPayment'), 0, 'payment');

$paiement = new PaiementFourn($db);
$result=$paiement->fetch($_GET['id']);
if ($result > 0)
{

	/*
	 * Confirmation de la suppression du paiement
	 */
	if ($_GET['action'] == 'delete')
	{
		$ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete');
		if ($ret == 'html') print '<br>';
	}

	/*
	 * Confirmation de la validation du paiement
Example #12
0
{
    $facturefourn = new FactureFournisseur($db);
    $facturefourn->fetch($facid);
    $facturefourn->label=$_POST['label'];
    $result=$facturefourn->update($user);
    if ($result < 0) dol_print_error($db);
    $_GET['facid']=$facid;
}

if($_GET['action'] == 'deletepaiement')
{
    $facfou = new FactureFournisseur($db);
    $facfou->fetch($_GET['facid']);
    if ($facfou->statut == 1 && $facfou->paye == 0 && $user->societe_id == 0)
    {
        $paiementfourn = new PaiementFourn($db);
        $paiementfourn->fetch($_GET['paiement_id']);
        $paiementfourn->delete();
    }
}

if ($_POST['action'] == 'update' && ! $_POST['cancel'])
{
    $error=0;

    $date = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
    $date_echeance = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);

    if (! $date)
    {
        $msg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEch"));