Exemple #1
0
}
if ($book['checkoutdate']) {
    $checkout = $book['checkoutdate'];
}
$guestname = $book['guestname'];
if (!$trans_date) {
    $trans_date = $today;
}
if (!$rcpt_date) {
    $rcpt_date = $today;
}
if (!$quantity) {
    $quantity = 1;
}
if ($bid && !$rateid) {
    $rateid = get_bookingrate($bid);
}
if (!$guestname) {
    $guestname = $res['guestname'];
}
if (!$guestname) {
    $guestname = get_guestname($guestid);
}
$mscludge = "";
if (preg_match('/MSIE/i', $_SERVER['HTTP_USER_AGENT'])) {
    $mscludge = 'onfocus="javascript: this.style.width=\'auto\';" onblur="javascript: this.style.width=18;"';
}
$i = 0;
while ($i < $bill['transcount']) {
    if ($bill['trans'][$i]['status'] != STATUS_VOID) {
        if (isset($totalArr[$bill['trans'][$i]['currency']])) {
Exemple #2
0
/**
 * Add room charges to the bill for the date, calculate from the rate id supplied
 * or the default room rate.
 *
 * @ingroup INVOICE_MANAGEMENT
 * @param $billid [in] Invoice /Bill id
 * @param $roomid [in] Room id for the charge to be used.
 * @param $rateid [in] Rate to use in calculation of discount
 * @param $start [in] Start date in dd/mm/yyyy format
 * @param $end  [in] End date in dd/mm/yyyy format
 * @param $userid [in] id of user adding the charges.
 * 
 */
function add_roomcharges($billid, $roomid, $rateid, $start, $end, $userid)
{
    $quantity = 1;
    //print "Start ".$start." End ".$end."<br/>";
    $start = str_replace("/", "-", $start);
    list($dd, $mm, $yy) = sscanf($start, "%d-%d-%d");
    $sdate = mktime(0, 0, 0, $mm, $dd, $yy);
    $end = str_replace("/", "-", $end);
    list($dd, $mm, $yy) = sscanf($end, "%d-%d-%d");
    $edate = mktime(0, 0, 0, $mm, $dd, $yy);
    $dt = $sdate;
    $today = date("d/m/Y");
    if (!$rateid) {
        // Retrieve booking rate id
        $rateid = get_bookingrate(get_bill_bookid($billid));
        //		print "Try using booking rate ".$rateid."<br/>";
    }
    while ($dt < $edate) {
        $tottax = 0;
        $totamt = 0;
        $totsvc = 0;
        $amount = 0;
        $tax = 0;
        $svc = 0;
        $itemid = 0;
        $lrate = $rateid;
        $trans_date = date("d/m/Y", $dt);
        //		print "Trans date ".$trans_date."<br/>";
        $ratedetails = array();
        get_rateitems($rateid, $ratedetails);
        $curr = get_Currency_byRateID($rateid);
        //print_r($ratedetails);
        $roomamt = 0;
        foreach ($ratedetails as $ratedetail) {
            $roomamt = $roomamt + $ratedetail['discountvalue'];
            $svc = 0;
            if (!$ratedetail['service']) {
                $svc = $svc + $ratedetail['discountvalue'] * SVCPCT / 100;
            }
            $tax = 0;
            if (!$ratedetail['tax']) {
                $tax = $tax + $ratedetail['discountvalue'] * TAXPCT / 100;
            }
            $newamt = $ratedetail['discountvalue'] + $svc + $tax;
            $totamt = $totamt + $newamt;
            $totsvc = $totsvc + $svc;
            $tottax = $tottax + $tax;
        }
        //$gross = get_ratecharges($itemid, $quantity, $roomid, $trans_date, $lrate, $std_amount, $std_tax, $std_svc, $amount, $tax, $svc);
        modify_transaction(0, $billid, 1, $today, $trans_date, $userid, $roomamt, $totsvc, $tottax, $roomamt, $totsvc, $tottax, $quantity, $rateid, "", $totamt, $curr);
        $dt = $dt + 24 * 60 * 60;
    }
}