コード例 #1
0
ファイル: facture.php プロジェクト: Samara94/dolibarr
 // $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
 $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
 if ($object->paye) {
     $resteapayer = 0;
 }
 $resteapayeraffiche = $resteapayer;
 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
     $filterabsolutediscount = "fk_facture_source IS NULL";
     // If we want deposit to be substracted to payments only and not to total of final invoice
     $filtercreditnote = "fk_facture_source IS NOT NULL";
     // If we want deposit to be substracted to payments only and not to total of final invoice
 } else {
     $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')";
     $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
 }
 $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
 $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
 $absolute_discount = price2num($absolute_discount, 'MT');
 $absolute_creditnote = price2num($absolute_creditnote, 'MT');
 $author = new User($db);
 if ($object->user_author) {
     $author->fetch($object->user_author);
 }
 $objectidnext = $object->getIdReplacingInvoice();
 $head = facture_prepare_head($object);
 dol_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'), 0, 'bill');
 $formconfirm = '';
 // Confirmation de la conversion de l'avoir en reduc
 if ($action == 'converttoreduc') {
     $text = $langs->trans('ConfirmConvertToReduc');
     $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2);
コード例 #2
0
ファイル: prelevement.php プロジェクト: remyyounes/dolibarr
        $totalpaye  = $fac->getSommePaiement();
        $totalcreditnotes = $fac->getSumCreditNotesUsed();
        $totaldeposits = $fac->getSumDepositsUsed();
        //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;

        // We can also use bcadd to avoid pb with floating points
        // For example print 239.2 - 229.3 - 9.9; does not return 0.
        //$resteapayer=bcadd($fac->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
        //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
        $resteapayer = price2num($fac->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');

        if ($fac->paye) $resteapayer=0;
        $resteapayeraffiche=$resteapayer;

        $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
        $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
        $absolute_discount=price2num($absolute_discount,'MT');
        $absolute_creditnote=price2num($absolute_creditnote,'MT');

        $author = new User($db);
        if ($fac->user_author)
        {
            $author->fetch($fac->user_author);
        }

        $head = facture_prepare_head($fac);

        dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');

        /*
コード例 #3
0
ファイル: propal.php プロジェクト: remyyounes/dolibarr
	print '</tr></table>';
	print '</td><td colspan="5">';
	print $object->ref_client;
	print '</td>';
	print '</tr>';

	$rowspan=8;

	// Company
	print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>';

	// Ligne info remises tiers
	print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
	if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
	else print $langs->trans("CompanyHasNoRelativeDiscount");
	$absolute_discount=$societe->getAvailableDiscounts();
	print '. ';
	if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
	else print $langs->trans("CompanyHasNoAbsoluteDiscount");
	print '.';
	print '</td></tr>';

	// Dates
	print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
	print dol_print_date($object->date,'daytext');
	print '</td>';

	if ($conf->projet->enabled) $rowspan++;

	//Local taxes
	if ($mysoc->pays_code=='ES')
コード例 #4
0
 /**
  * 
  * Return POS Config
  * 
  * @return	array		Array with config
  */
 public static function getConfig()
 {
     global $db, $conf, $langs;
     $cash = new Cash($db);
     $terminal = $_SESSION['TERMINAL_ID'];
     $cash->fetch($terminal);
     $userstatic = new User($db);
     $userstatic->fetch($_SESSION['uid']);
     $soc = new Societe($db, $cash->fk_soc);
     $soc->fetch($cash->fk_soc);
     $name = $soc->name ? $soc->name : $soc->nom;
     $ret['error']['value'] = 0;
     $ret['error']['desc'] = '';
     $ret['data']['terminal']['id'] = $cash->id;
     $ret['data']['terminal']['name'] = $cash->name;
     $ret['data']['terminal']['tactil'] = $cash->tactil;
     $ret['data']['terminal']['warehouse'] = $cash->fk_warehouse;
     $ret['data']['terminal']['barcode'] = $cash->barcode;
     $ret['data']['terminal']['mode_info'] = 0;
     $ret['data']['terminal']['faclimit'] = $conf->global->POS_MAX_TTC;
     $ret['data']['module']['places'] = $conf->global->POS_PLACES;
     $ret['data']['module']['print'] = $conf->global->POS_PRINT;
     $ret['data']['module']['mail'] = $conf->global->POS_MAIL;
     $ret['data']['module']['points'] = $conf->global->REWARDS_DISCOUNT;
     $ret['data']['module']['ticket'] = $conf->global->POS_TICKET;
     $ret['data']['module']['facture'] = $conf->global->POS_FACTURE;
     $ret['data']['module']['print_mode'] = $conf->global->POS_PRINT_MODE;
     $ret['data']['user']['id'] = $userstatic->id;
     $ret['data']['user']['name'] = $userstatic->getFullName($langs);
     $dir = $conf->user->dir_output;
     if ($userstatic->photo) {
         $file = get_exdir($userstatic->id, 2) . $userstatic->photo;
     }
     if ($file && file_exists($dir . "/" . $file)) {
         $ret['data']['user']['photo'] = DOL_URL_ROOT . '/viewimage.php?modulepart=userphoto&entity=' . $userstatic->entity . '&file=' . urlencode($file);
     } else {
         $ret['data']['user']['photo'] = DOL_URL_ROOT . '/theme/common/nophoto.jpg';
     }
     $ret['data']['customer']['id'] = $soc->id;
     $ret['data']['customer']['name'] = $name;
     $ret['data']['customer']['remise'] = $soc->remise_percent;
     $ret['data']['customer']['coupon'] = $soc->getAvailableDiscounts();
     $ret['data']['customer']['points'] = null;
     if ($conf->global->REWARDS_POS && !empty($conf->rewards->enabled)) {
         $rew = new Rewards($db);
         $res = $rew->getCustomerReward($soc->id);
         if ($res) {
             $ret['data']['customer']['points'] = $rew->getCustomerPoints($soc->id);
         }
     }
     $ret['data']['decrange']['unit'] = $conf->global->MAIN_MAX_DECIMALS_UNIT;
     $ret['data']['decrange']['tot'] = $conf->global->MAIN_MAX_DECIMALS_TOT;
     $ret['data']['decrange']['maxshow'] = $conf->global->MAIN_MAX_DECIMALS_SHOWN;
     return $ret;
 }