Ejemplo n.º 1
0
        $db->begin();
        $ret = $tva->addPayment($user);
        if ($ret > 0) {
            $db->commit();
            header("Location: reglement.php");
            exit;
        } else {
            $db->rollback();
            setEventMessages($tva->error, $tva->errors, 'errors');
            $action = "create";
        }
    }
    $action = 'create';
}
if ($action == 'delete') {
    $result = $tva->fetch($id);
    if ($tva->rappro == 0) {
        $db->begin();
        $ret = $tva->delete($user);
        if ($ret > 0) {
            if ($tva->fk_bank) {
                $accountline = new AccountLine($db);
                $result = $accountline->fetch($tva->fk_bank);
                if ($result > 0) {
                    $result = $accountline->delete($user);
                }
                // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
            }
            if ($result >= 0) {
                $db->commit();
                header("Location: " . DOL_URL_ROOT . '/compta/tva/reglement.php');
Ejemplo n.º 2
0
     $tmparray = $paymentsupplierstatic->getBillsArray('');
     foreach ($tmparray as $key => $val) {
         $invoicesupplierstatic->fetch($val);
         if ($accountelem) {
             $accountelem .= ', ';
         }
         $accountelem .= $invoicesupplierstatic->ref;
     }
 } elseif ($links[$key]['type'] == 'payment_sc') {
     $paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
     if ($accountelem) {
         $accountelem .= ', ';
     }
     $accountelem .= $langs->transnoentitiesnoconv("SocialContribution") . ' ' . $paymentsocialcontributionstatic->ref;
 } elseif ($links[$key]['type'] == 'payment_vat') {
     $paymentvatstatic->fetch($links[$key]['url_id']);
     if ($accountelem) {
         $accountelem .= ', ';
     }
     $accountelem .= $langs->transnoentitiesnoconv("VATPayments") . ' ' . $paymentvatstatic->ref;
 } elseif ($links[$key]['type'] == 'banktransfert') {
     $comment = $outputlangs->transnoentitiesnoconv("Transfer");
     if ($objp->amount > 0) {
         if ($comment) {
             $comment .= ' ';
         }
         $banklinestatic->fetch($links[$key]['url_id']);
         $bankstatic->id = $banklinestatic->fk_account;
         $bankstatic->label = $banklinestatic->bank_account_label;
         $comment .= ' (' . $langs->transnoentitiesnoconv("from") . ' ';
         $comment .= $bankstatic->getNomUrl(1, 'transactions');
Ejemplo n.º 3
0
	}
}


/*
*	View
*/

llxHeader();

$html = new Form($db);

if ($id)
{
    $vatpayment = new Tva($db);
	$result = $vatpayment->fetch($id);
	if ($result <= 0)
	{
		dol_print_error($db);
		exit;
	}
}

// Formulaire saisie tva
if ($_GET["action"] == 'create')
{
    print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
    print '<input type="hidden" name="action" value="add">';

    print_fiche_titre($langs->trans("NewVATPayment"));