$tottax = $tottax + $tax; } $newCheckinDate = $reserved_date; for ($dc = 0; $dc < $no_nights; $dc++) { modify_transaction(0, $bill_id, 1, $reserved_date, $newCheckinDate, $userid, $roomamt, $totsvc, $tottax, $roomamt, $totsvc, $tottax, 1, $ratesid, '', $totamt, $curr); $newCheckinDate = date("Y-m-d", strtotime('+1 day', strtotime($newCheckinDate))); } } else { if (isset($_POST['payinadvance']) && !$resdetailID && $resdetailcount > 0) { foreach ($details as $dt) { $rtid = $dt['ratesid']; $ratedetails = array(); if ($rtid) { get_rateitems($rtid, $ratedetails); } $curr = get_Currency_byRateID($rtid); //print_r($ratedetails); $roomamt = 0; $totamt = $roomamt; $totsvc = 0; $tottax = 0; $stdsvc = 0; $stdtax = 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']) {
/** * 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; } }