241 lines
14 KiB
PHP
241 lines
14 KiB
PHP
<?php
|
|
class RPT_DAILY extends RPT
|
|
{
|
|
public function rpt_daily_javainit()
|
|
{
|
|
|
|
}
|
|
|
|
public function fn_daily_init()
|
|
{
|
|
if(isset($_REQUEST['task'])){$task=trim(strtolower($_REQUEST['task']));}
|
|
if(isset($_POST['task'])){$task=trim(strtolower($_POST['task']));}
|
|
if($_REQUEST||$_POST){if($_REQUEST['sec']||$_POST['sec']){$task=$this->dec($task);}}
|
|
|
|
switch($task)
|
|
{
|
|
case "default":
|
|
$this->fn_default_daily();
|
|
break;
|
|
|
|
case $task:
|
|
$task="fn_".$task;
|
|
if(method_exists($this,$task)){$this->$task();}
|
|
break;
|
|
|
|
default:
|
|
$this->fn_default_daily();
|
|
break;
|
|
}
|
|
}
|
|
|
|
public function fn_default_daily()
|
|
{
|
|
echo $this->FN_CREATEHEADER();
|
|
|
|
echo "<style>
|
|
.besidebtnsave {margin-left:104px;margin-top:-6px;position:absolute;}
|
|
.besidebtnupdate {margin-left:198px;margin-top:-6px;position:absolute;}
|
|
.besidebtndelete {margin-left:288px;margin-top:-6px;position:absolute;}
|
|
</style>";
|
|
echo "<script>
|
|
var myForm,myFormsearch,dgtra;
|
|
function initObject()
|
|
{
|
|
var docheight=$(document).height();
|
|
var docwidth=$(document).width();
|
|
$('#ifrpt').height(docheight-115);
|
|
$('#ifrpt').width('100%');";
|
|
$formdata=array(
|
|
array("type"=>"settings","position"=>"label-left","labelWidth"=>"20","inputWidth"=>"120"),
|
|
array("type"=>"block","width"=>"1040","label"=>"Laporan Histori Deposit",
|
|
"list"=>array(
|
|
array("type"=>"calendar","name"=>"txt_dates","label"=>"","info"=>"true","inputWidth"=>"110","value"=>date("Y-m-d"),"note"=>array("text"=>"[?] Dates"),
|
|
"tooltip"=>"Masukkan Tahun Terlebih dahulu","maxLength"=>"9","className"=>"txtcenter","labelWidth"=>"0","offsetLeft"=>"0"),
|
|
array("type"=>"newcolumn"),
|
|
array("type"=>"combo","name"=>"cbo_idemployee","label"=>"","required"=>"false","info"=>"true","inputWidth"=>"260",
|
|
"tooltip"=>"","maxLength"=>"6","className"=>"txtleft","offsetLeft"=>"10",
|
|
"note"=>array("text"=>"[?] Cashier Name")),
|
|
array("type"=>"newcolumn"),
|
|
array("type"=>"button","name"=>"btnsearch","value"=>"","className"=>"button_find","offsetLeft"=>"5","offsetTop"=>"5","disabled"=>0),
|
|
)
|
|
)
|
|
);
|
|
$this->FN_DHTMLXFORM("myForm","divsearchcategory",$formdata,"");
|
|
// === Form Init
|
|
$arrerror=array("txt_dates"=>"Error Found : Please Insert <b>Dates</b> First. Thank You");
|
|
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
|
|
|
|
|
|
// === Init Employee Name
|
|
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_employee|id,employeename')";
|
|
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idemployee","tbl_employee","$urlcbo","");
|
|
|
|
|
|
|
|
$eventbtnsearch="var url='?ajax=1&sec=1&option=".$this->enc("obj_rpt")."&obj=".$this->enc("rpt_daily")."&task=".$this->enc("rptload")."';";
|
|
$eventbtnsearch.=" url=url+'&dates='+myForm.getCalendar('txt_dates').getDate(true)+'&idemployee='+myForm.getItemValue('cbo_idemployee');";
|
|
$eventbtnsearch.="document.getElementById('ifrpt').src=url;";
|
|
$eventbtnsearch.="setTimeout(function(){".$this->FN_DHTMLXWINDOWSHIDEPROGRESS().";},2500);";
|
|
$onclickbtnsearch.="if(myForm.validate()){".$this->FN_DHTMLXWINDOWSHOWPROGESS($eventbtnsearch)."}";
|
|
|
|
$filexls="var params='month='+myForm.getItemValue('cbo_month')+'&period='+myForm.getItemValue('txt_period')+'&idsubunit='+myForm.getItemValue('cbo_idsubunit');";
|
|
$filexls.=" params=params+'&idemployee='+myForm.getItemValue('cbo_idemployee')+'&idsubunit='+myForm.getItemValue('cbo_idsubunit');";
|
|
$filexls.="if(myForm.getItemValue('cbo_idsubunit'))";
|
|
$filexls.="{";
|
|
$filexls.=" var urlrpt='?sec=1&xlson=1&xls=".$this->enc("xlshcmabssbnit")."&'+params;";
|
|
$filexls.="}";
|
|
$filexls.="else";
|
|
$filexls.="{";
|
|
$filexls.=" var urlrpt='?sec=1&xlson=1&xls=".$this->enc("xlshcmabs")."&'+params;";
|
|
$filexls.="}";
|
|
$onclickbtnexcel=$filexls;
|
|
$onclickbtnexcel.="a_rpt.href=urlrpt;a_rpt.click();";
|
|
|
|
$arrevent=array(
|
|
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
|
|
"switch"=>array(
|
|
"btnsearch"=>"$onclickbtnsearch",
|
|
"btnexcel"=>"$onclickbtnexcel"
|
|
)
|
|
)
|
|
);
|
|
|
|
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
|
|
|
|
echo " }
|
|
|
|
function fn_grid_loaddata()
|
|
{";
|
|
|
|
echo " }
|
|
window.onresize = function(event) {
|
|
var docheight=$(document).height();
|
|
var docwidth=$(document).width();
|
|
$('#ifrpt').height(docheight-115);
|
|
$('#ifrpt').width('100%');
|
|
//alert(docwidth);
|
|
};
|
|
</script>";
|
|
echo $this->FN_CLOSEHEADER();
|
|
echo $this->FN_CREATEBODY("e8f1ff");
|
|
|
|
echo $this->CREATE_LINK("","xls","","_self","","","margin-top:-122px;position:absolute;","id=\"a_rpt\" name=\"a_rpt\"");
|
|
echo "<table width=\"97%\" border=\"0\">
|
|
<tr>
|
|
<td width=\"90%\" valign=\"top\"><div id=\"divsearchcategory\" style=\"\"></div></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign=\"top\" style=\"padding:8px;background:gray;\">
|
|
<iframe id=\"ifrpt\" name=\"ifrpt\" src=\"\" frameborder=\"0\"width=\"100%\" scrolling=\"auto\" style=\"height:370px;margin-left:0px;background-color:white;\"></iframe>
|
|
</td>
|
|
</tr>
|
|
</table>";
|
|
|
|
echo $this->FN_CREATEFOOTER();
|
|
|
|
}
|
|
|
|
public function fn_rptload()
|
|
{
|
|
$dates=$_REQUEST['dates'];
|
|
$idemployee=$_REQUEST['idemployee'];
|
|
$nik=$this->fn_get_fieldvalue("nik","select nik from ".DB_APORTIL.".tbl_employee where id='$idemployee'");
|
|
$totdays=cal_days_in_month(CAL_GREGORIAN,$month,$period);
|
|
|
|
include("lib/mpdf/mpdf.php");
|
|
//$mpdf=new mPDF('L','A4-L','','',3,3,29,10);
|
|
$top=32;
|
|
$mpdf = new mPDF('c', 'A4', 2, 2, 5, 5, $top, $top, 9, 9, 'L');
|
|
$mpdf->SetDisplayMode('fullpage');
|
|
//$mpdf=new mPDF('c', 'A4-L');
|
|
//$mpdf=new mPDF('L','','','','',25,25,55,45,18,12);
|
|
|
|
|
|
// LOAD a stylesheet
|
|
$stylesheet = file_get_contents('lib/mpdf/css/mpdfstyleA4.css');
|
|
$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
|
|
$htmlheader="Ticketing Daily Report<br/>";
|
|
$htmlheader.="<span>";
|
|
$htmlheader.=" <table width='100%' style='font-size:11'>";
|
|
$htmlheader.=" <tr>
|
|
<td width='20%'>Reported By</td>
|
|
<td width='2px'>:</td>
|
|
<td>( ".$_SESSION['employeename']." )</td>
|
|
</tr>";
|
|
$htmlheader.=" <tr>
|
|
<td>Date Reporting</td>
|
|
<td>:</td>
|
|
<td>".date("d M Y H:i:s")."</td>
|
|
</tr>";
|
|
$htmlheader.=" <tr>
|
|
<td>Periode Transaction</td>
|
|
<td>:</td>
|
|
<td>".date("d M Y",strtotime($dates))."</td>
|
|
</tr>";
|
|
$htmlheader.=" </table>";
|
|
$htmlheader.="</span></br>";
|
|
$htmlheader.="<div style='border-top:1px solid black;'> </div><br/>";
|
|
//$htmlheader.="<table width>";
|
|
|
|
$mpdf->SetHTMLHeader($htmlheader);
|
|
$mpdf->setFooter('{PAGENO} of {nbpg} pages||{PAGENO} of {nbpg} pages') ;
|
|
|
|
//$mpdf->AddPage('L','','','',5,5,5,5);
|
|
$html="<table width='100%' style='font-size:12' cellpadding='0' cellspacing='0'>";
|
|
$html.="<tr>";
|
|
$html.=" <td width='23' style='border-bottom:1px dotted black'>No.</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black'>Tiket Number</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black'>Voy. Number</td>";
|
|
//$html.=" <td width='80' style='border-bottom:1px dotted black'>Ship Number</td>";
|
|
$html.=" <td width='100' style='border-bottom:1px dotted black'>Passenger</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black'>Identity</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black'>Route</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black;text-align:right;'>Price </td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black;text-align:right;vertical-align: middle;'>Baggage <br/>( kg )</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black;text-align:right'>Over<br/>Baggage</td>";
|
|
$html.=" <td width='80' style='border-bottom:1px dotted black;text-align:right'>Total Price </td>";
|
|
$html.="</tr>";
|
|
$qry="select id, idship, tiketnumber, voynumber, inctiket, shipnumber, shipname, passengername, idcardtype, cardtype, cardnumber,
|
|
picdata, dates, idroutestart, routenamestart, idrouteend, routenameend, seatnumber, quantity, price, baggageinkg,
|
|
limitbaggage, overlimitbaggage, priceoverinkg, pricebaggage, totalprice from ".DB_APORTIL.".tbl_passenger_tiket
|
|
where iby='$nik' and isdeleted=0 and cast(dates as date)=cast('$dates' as date)
|
|
order by id asc";
|
|
|
|
$rs=$this->selectquery($qry);
|
|
if($rs){
|
|
$i=1;$totalprice=0;
|
|
while($rw=$this->data_row_object($rs)){
|
|
$html.="<tr>";
|
|
$html.=" <td style='height:20px'>$i.</td>";
|
|
$html.=" <td>".$rw->tiketnumber."</td>";
|
|
$html.=" <td>".$rw->voynumber."</td>";
|
|
//$html.=" <td>".$rw->shipnumber."</td>";
|
|
$html.=" <td>".$rw->passengername."</td>";
|
|
$html.=" <td>".$rw->cardtype."/".$rw->cardnumber."</td>";
|
|
$html.=" <td>".$rw->routenamestart."-".$rw->routenameend."</td>";
|
|
$html.=" <td style='text-align:right;'>\$".number_format($rw->price,2)."</td>";
|
|
$html.=" <td style='text-align:right;'>".$rw->baggageinkg." kg</td>";
|
|
$html.=" <td style='text-align:right;'>\$".number_format($rw->pricebaggage,2)."</td>";
|
|
$html.=" <td style='text-align:right;'>\$".number_format($rw->totalprice,2)."</td>";
|
|
$html.="</tr>";
|
|
$i+=1;
|
|
$totalprice+=$rw->totalprice;
|
|
}
|
|
$html.="<tr>";
|
|
$html.=" <td colspan='9' style='border-top:1px dotted black;text-align:right'>Grand Total : </td>";
|
|
$html.=" <td style='border-top:1px dotted black;text-align:right;font-weight:bold'>\$".number_format($totalprice,2)."</td>";
|
|
$html.="</tr>";
|
|
|
|
}
|
|
$html.="</table>";
|
|
//$html=$qry;
|
|
//$mpdf->SetDisplayMode('fullwidth');
|
|
$mpdf->WriteHTML($html);
|
|
// $mpdf->Output();
|
|
$mpdf->Output('DailyRepot_'.date("Ymd").'.pdf','I');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
?>
|