//echo "$sqlBranch"; }; mBranchName; ht/////////////////////////////////////////////////////////////////////////////////////// function pdf_text_right($Pos_start,$text) { Pt=''; if($len<=6){$Pt=20.5-$len;} else {$Pt=20-$len;}; ) { @$date1 = explode("/",$DateStart); e1[0] 00:00:00"; eEnd) { ate1[0] 23:00:00"; return $today_en; } ========// { r_Sign_In where clCarFrameNo='$carFrame' "; carss); //====================================// nId='$signid' order by signId desc"; d"]; } ==========// function carMinorMajor($carFrameNo){ $cars="select * from CarList where carFrameNo='$carFrameNo' "; $rocar=mssql_fetch_array($excar); $carFrameNo=trim($rocar["carFrameNo"]); $carEngineNo=$rocar["carEngineNo"]; ndId"]; $checkbrand="select * from KeyCarBrand where keyId='$carBrandId' "; eckbrand); $res=mssql_fetch_array($exxbrand); $carBrandId=$res["keyValue"]; jorId"]; $checkModel="select * from KeyCarModelMajor where keyId='$carModelMajorId' "; $exxModel=mssql_query($checkModel); $reModel=mssql_fetch_array($exxModel); $carModelMajorId=$reModel["keyValue"]; $carModelMinorId=$rocar["carModelMinorId"]; $checkModelm="select * from KeyCarModelMinor where keyId='$carModelMinorId' "; delm=mssql_query($checkModelm); $reModelm=mssql_fetch_array($exxModelm); $carModelMinorId=$reModelm["keyValue"]; $carFuelId=$rocar["carFuelId"]; eckFuel="select * from KeyCarFuel where keyId='$carFuelId' "; y($checkFuel); $reFuel=mssql_fetch_array($exxFuel); $carFuelId=$reFuel["keyValue"]; e"]; ]; $carSeatCount=$rocar["carSeatCount"]; $carYear=$rocar["carYear"]; Types"]; if($carTypes==1){$carTypes="öà¡ê§";} ";} SUV";} if($carTypes==5){$carTypes="öâ´ÂÊÒÃ";} $carTypeRent=$rocar["carTypeRent"]; ar["carTypeReg"]; FreeInsure"]; Tax"]; $carPriceTax=$rocar["carPriceTax"]; arPriceBody"]; $rubberModel=$rocar["rubberModel"]; ubberB_R"]; car["rubberF_R_Depth"]; B_L_Depth"]; carModelId"]; Id' "; $excon=mssql_query($namecon); $rocon=mssql_fetch_array($excon); arStatus"]; arStatus="ÍÂÙè·ÕèÕÅÙ¡¤éÒè";} $carModelMajorId_carModelMajorId=" $carModelMajorId $carModelMinorId"; return $carModelMajorId_carModelMajorId; =======// =======// re carId='$carId' "; $carFrameNo=trim($rocar["carFrameNo"]); $carEngineNo=$rocar["carEngineNo"]; lect * from KeyCarBrand where keyId='$carBrandId' "; ssql_query($checkbrand); $res=mssql_fetch_array($exxbrand); $carBrandId=$res["keyValue"]; elMajorId"]; ="select * from KeyCarModelMajor where keyId='$carModelMajorId' "; ry($checkModel); $reModel=mssql_fetch_array($exxModel); $carModelMajorId=$reModel["keyValue"]; from KeyCarModelMinor where keyId='$carModelMinorId' "; $checkModelm); $reModelm=mssql_fetch_array($exxModelm); $carModelMinorId=$reModelm["keyValue"]; return $carFrameNo_r; ==========// function carBranId($carFrameNo){ $carFrameNo=trim($carFrameNo); $cars="select * from CarList where carFrameNo='$carFrameNo' "; $rocar=mssql_fetch_array($excar); $carFrameNo=trim($rocar["carFrameNo"]); $carEngineNo=$rocar["carEngineNo"]; $rocar["carRegNo"]); carBrandId=$rocar["carBrandId"]; $checkbrand="select * from KeyCarBrand where keyId='$carBrandId' "; eckbrand); $res=mssql_fetch_array($exxbrand); $carBrandId=$res["keyValue"]; car["carModelMajorId"]; $checkModel="select * from KeyCarModelMajor where keyId='$carModelMajorId' "; ; $reModel=mssql_fetch_array($exxModel); $carModelMajorId=$reModel["keyValue"]; =$rocar["carModelMinorId"]; Modelm="select * from KeyCarModelMinor where keyId='$carModelMinorId' "; sql_query($checkModelm); $reModelm=mssql_fetch_array($exxModelm); $carModelMinorId=$reModelm["keyValue"]; uelId"]; * from KeyCarFuel where keyId='$carFuelId' "; query($checkFuel); $reFuel=mssql_fetch_array($exxFuel); $carFuelId=$reFuel["keyValue"]; ize"]; if($carGearType=='A'){ $carGearType="AUTOMATIC";} $exx=mssql_query($check); $res=mssql_fetch_array($exx); $carColorId=$res["keyValue"]; $exx=mssql_query($check); $res=mssql_fetch_array($exx); $carDriveId=$res["keyValue"]; if($carTypes==2){$carTypes="ö¡ÃкÐ";} ";} ]; r["carPriceNoTax"]; $carPriceBody=$rocar["carPriceBody"]; arAverage"]; $carRemark=$rocar["carRemark"]; neSizeDef"]; $rubberBrand=$rocar["rubberBrand"]; $rubberModel=$rocar["rubberModel"]; $rubberF_R=$rocar["rubberF_R"]; $rubberF_L_Depth=$rocar["rubberF_L_Depth"]; ["rubberF_R_Depth"]; $rubberB_L_Depth=$rocar["rubberB_L_Depth"]; $rubberB_R_Depth=$rocar["rubberB_R_Depth"]; Depth=$rocar["rubberReserve_Depth"]; carModelId=$rocar["carModelId"]; $namecon="select cpId,cpname_sub from ContactPerson where cpId='$cpId' "; n=mssql_fetch_array($excon); "]; $carStatus=$rocar["carStatus"]; us="Stock In";} ѧÊè§è";} if($carStatus==3){$carStatus="ÍÂÙè·ÕèÕÅÙ¡¤éÒè";} // $carId' "; cars); ); car["carFrameNo"]); d='$carBrandId' "; $exxbrand=mssql_query($checkbrand); $res=mssql_fetch_array($exxbrand); $carBrandId=$res["keyValue"]; $exxModel=mssql_query($checkModel); $reModel=mssql_fetch_array($exxModel); $carModelMajorId=$reModel["keyValue"]; $exxModelm=mssql_query($checkModelm); $reModelm=mssql_fetch_array($exxModelm); $carModelMinorId=$reModelm["keyValue"]; $carFuelId=$rocar["carFuelId"]; $checkFuel="select * from KeyCarFuel where keyId='$carFuelId' "; l=mssql_query($checkFuel); $reFuel=mssql_fetch_array($exxFuel); $carFuelId=$reFuel["keyValue"]; $carEngineSize=$rocar["carEngineSize"]; '){ $carGearType="MANUAL";} ='A'){ $carGearType="AUTOMATIC";} $check="select * from KeyCarColor where keyId='$carColorId' "; y($check); $res=mssql_fetch_array($exx); $carColorId=$res["keyValue"]; om KeyCarDrive where keyId='$carDriveId' "; y($check); $res=mssql_fetch_array($exx); $carDriveId=$res["keyValue"]; t"]; $cpId=$rocar["cpId"]; ctPerson where cpId='$cpId' "; n=mssql_fetch_array($excon); ;} if($carStatus==2){$carStatus="¡ÓÅѧÊè§è";} Òè";} return $cardet; function carColorId2($carFrameNo){ $carFrameNo=trim($carFrameNo); $cars="select * from CarList where carFrameNo='$carFrameNo' "; $rocar=mssql_fetch_array($excar); $carFrameNo=trim($rocar["carFrameNo"]); $carEngineNo=$rocar["carEngineNo"]; $rocar["carRegNo"]); carBrandId=$rocar["carBrandId"]; CarBrand where keyId='$carBrandId' "; y($checkbrand); $res=mssql_fetch_array($exxbrand); $carBrandId=$res["keyValue"]; lect * from KeyCarModelMajor where keyId='$carModelMajorId' "; $exxModel=mssql_query($checkModel); $reModel=mssql_fetch_array($exxModel); $carModelMajorId=$reModel["keyValue"]; ect * from KeyCarModelMinor where keyId='$carModelMinorId' "; tch_array($exxModelm); $carModelMinorId=$reModelm["keyValue"]; * from KeyCarFuel where keyId='$carFuelId' "; el=mssql_query($checkFuel); $reFuel=mssql_fetch_array($exxFuel); $carFuelId=$reFuel["keyValue"]; pe"]; { $carGearType="MANUAL";} A'){ $carGearType="AUTOMATIC";} ColorId=$rocar["carColorId"]; select * from KeyCarColor where keyId='$carColorId' "; $exx=mssql_query($check); $res=mssql_fetch_array($exx); $carColorId=$res["keyValue"]; riveId=$rocar["carDriveId"]; CarDrive where keyId='$carDriveId' "; $check); $res=mssql_fetch_array($exx); $carDriveId=$res["keyValue"]; Ùé";} ;} TypeReg=$rocar["carTypeReg"]; eInsure"]; $rubberBrand=$rocar["rubberBrand"]; $rubberModel=$rocar["rubberModel"]; F_L"]; rubberF_R=$rocar["rubberF_R"]; $rubberB_L=$rocar["rubberB_L"]; $rubberB_L_Depth=$rocar["rubberB_L_Depth"]; R_Depth"]; Reserve_Depth"]; ModelId=$rocar["carModelId"]; ctPerson where cpId='$cpId' "; mssql_fetch_array($excon); ; return $cardet; ///////////////////////////////////////////////// function sql_open_connection_scr() { ', ''); ////////////////////////// m List_Car_Sign_In where clCarFrameNo='$carFrameNo' "; osignid["siId"]; ]; rn $siDateEnd; } ureStartDate, InsureEndDate, InsureId, InsureConfirmNo, InsureComId, InsureType, InsureTypeR, carFrameNo, carRegNo ROM InsureAddCar Where InsureConfirmNo='$InsuNo' "; $excar=mssql_query($sqlINno); EndDate"]; e"]; 'InsureStartDate'=>$InsureStartDate, 'InsureEndDate'=>$InsureEndDate, InsureConfirmNo'=>$InsureConfirmNo, 'InsureComId'=>$InsureComId, ureType'=>$InsureType, 'InsureTypeR'=>$InsureTypeR, ); nsureEndDate, InsureId, InsureConfirmNo, InsureComId, InsureType, InsureTypeR, carFrameNo, carRegNo eEndDate DESC, InsureTypeR"; tartDate"]; reEndDate"]; reConfirmNo"]; $InsureComId=$row["InsureComId"]; $InsureType=$row["InsureType"]; 'InsureStartDate'=>$InsureStartDate, InsureId, rmNo, 'InsureComId'=>$InsureComId, 'InsureType'=>$InsureType, admins WHERE (company='$companyId') "; mssql_query($sql1); $row1=mssql_fetch_array($excescom1); ]; comBranch where comBranch.comBId='$branchId' "; Branch); ame"]; ]=$row2["comBId"]; ch"; $date="01-02-2008"; 9])|([1-2][0-9])|(3[0-1]))(-)((0?[1-9])|(1[0-2]))(-)(20[0-9]{2})?$",$date)) {echo"true1
";} else {echo "no1
";}; 9])|([1-2][0-9])|(3[0-1]))(/)((0?[1-9])|(1[0-2]))(/)(20[0-9]{2})?$",$date2)) {echo"true2
";} else {echo "no2";}; ; ?[1-9])|(1[0-2]))(/)(25[0-9]{2})?$",$date3)) {echo"true3
";} 20[0-9]{2})(-)((0?[1-9])|(1[0-2]))(-)((0?[1-9])|([1-2][0-9])|(3[0-1]))?$",$date4)) {echo"true4
";} else {echo "no4";}; function eng2thai($date_1){ if(ereg("^(20[0-9]{2})(-)((0?[1-9])|(1[0-2]))(-)((0?[1-9])|([1-2][0-9])|(3[0-1]))?$",$date_1,$a_tegs)) { $date_1= "$a_tegs[7]/$a_tegs[3]/$yyyy"; }; ((0?[1-9])|([1-2][0-9])|(3[0-1]))(-)((0?[1-9])|(1[0-2]))(-)(20[0-9]{2})?$",$date_1,$a_tegs)) { $yyyy=$a_tegs[10]+543; }; if(ereg("^((0?[1-9])|([1-2][0-9])|(3[0-1]))(/)((0?[1-9])|(1[0-2]))(/)(20[0-9]{2})?$",$date_1,$a_tegs)) { $yyyy=$a_tegs[10]+543; }; } 1; } ///////////////////////////////////////////////////////// function thai2eng($date_2){ if(isset($date_2)){ 52-01-01 if(ereg("^(25[0-9]{2})(-)((0?[1-9])|(1[0-2]))(-)((0?[1-9])|([1-2][0-9])|(3[0-1]))?$",$date_2,$a_tegs)) { $yyyy=$a_tegs[1]-543; $date_2= "$yyyy-$a_tegs[3]-$a_tegs[7]"; if(ereg("^((0?[1-9])|([1-2][0-9])|(3[0-1]))(-)((0?[1-9])|(1[0-2]))(-)(25[0-9]{2})?$",$date_2,$a_tegs)) { $date_2= "$yyyy-$a_tegs[6]-$a_tegs[1]"; //01/02/2552 f(ereg("^((0?[1-9])|([1-2][0-9])|(3[0-1]))(/)((0?[1-9])|(1[0-2]))(/)(25[0-9]{2})?$",$date_2,$a_tegs)) { a_tegs[10]-543; return $date_2; //////////////////////////////////////////////////////////////////// if(isset($date_1)){ if(ereg("^(20[0-9]{2})(-)((0?[1-9])|(1[0-2]))(-)((0?[1-9])|([1-2][0-9])|(3[0-1]))?$",$date_1,$a_tegs)) { // $date_1= "$yyyy-$a_tegs[7]-$a_tegs[8]"; else {$date_1=$date_1;} 01 if(ereg("^(20[0-9]{2})(/)((0?[1-9])|(1[0-2]))(/)((0?[1-9])|([1-2][0-9])|(3[0-1]))?$",$date_1,$a_tegs)) { $yyyy=$a_tegs[1]; $date_1= "$yyyy-$a_tegs[7]-$a_tegs[8]"; lse {$date_1=$date_1;} ])|([1-2][0-9])|(3[0-1]))(-)((0?[1-9])|(1[0-2]))(-)(20[0-9]{2})?$",$date_1,$a_tegs)) { a_tegs[6]-$a_tegs[1]"; _1;} if(ereg("^((0?[1-9])|([1-2][0-9])|(3[0-1]))(/)((0?[1-9])|(1[0-2]))(/)(20[0-9]{2})?$",$date_1,$a_tegs)) { } else {$date_1=$date_1;} } //////////////////////DateDiff("2008-08-01","2008-10-31"////////output = day//////////////////////////////////////////////////////////////// End) { if($strDateStart!='' and $strDateEnd!=''){ strtotime($strDateStart))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24 Start;} imeDiff("00:00","19:00")////////////////////////////////////////////////////////////////////// trtotime($strTime1))/ ( 60 * 60 ); // 1 Hour = 60*60 08-08-01 00:00","2008-08-01 19:00")////////////////////////////////////////////////////////////////////////// function DateTimeDiff($strDateTime1,$strDateTime2) - strtotime($strDateTime1))/ ( 60 * 60 ); // 1 Hour = 60*60 /////////////////////////////////////DateDiff("2008-08-01","2008-10-31"////////output = month/////////////////////////////////////////////////////////////////// function DateDiff_m($strDateStart,$strDateEnd) return (strtotime($strDateEnd) - strtotime($strDateStart))/ ( 60 * 60 * 24 * 30); // 1 day = 60*60*24 } // DateDiff(-1) /// input month(int)//////////output = month/////////////////////////////////////////////////////////////////// m-d",strtotime($m." months")); //// -1 Month = -1 ////// days // weeks // year // next Thursday // ////////////////////////////////////////////////////////////////////////////////////////////////// ode) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// KmCarDay($carFrameNo,$DayNow,$KmNow){ //1 where carFrameNo='$carFrameNo' "; car2=mssql_fetch_array($excar2); Id"]; rModelMajorId2=$rocar2["carModelMajorId"]; arModelMinorId2=$rocar2["carModelMinorId"]; Car_Sign_Model.csModel = '$carModelMajorId2') "; else {$carModelMajorId2jj=''; } st_Car_Sign_Model.csModel2 = '$carModelMinorId2') "; else {$carModelMinorId2jj=''; } elect * from List_Car_Sign_In where clCarFrameNo='$carFrameNo' "; _fetch_array($excarss); $rosignid["siId"]; SELECT List_Car_Sign.siId, List_Car_Sign.clCarSend, d, List_Car_Sign.clDateStartRent, l.csBrand, List_Car_Sign_Model.csModel2 List_Car_Sign INNER JOIN List_Car_Sign_Model ON List_Car_Sign.csId = List_Car_Sign_Model.csId _Car_Sign.siId = '$signid') $carModelMajorId2jj $carModelMinorId2jj "; //1 $excarss2=mssql_query($signcar2); $rosignid2=mssql_fetch_array($excarss2); @$clDateSend=$rosignid2["clDateSend"]; se=DateDiff($clDateSend,$DayNow); yUse); rn $AaverageKmDay;} ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// * * A Class for Permission * * @global string */ ission{ var $name_user=0; ge_Name,$Page_Element_Id,$Element_Type = Null){ $name_user=trim($name_user); $this->getCodeHideById_Pms($Page_Element_Id); on setLevel_p($value){ $this->name_user=$value; } Function setPageName($value){ $this->Page_Name=$value; } Function setPage_Element_Id($value){ } etCodeShowById_Pms($ElementId){ etElementById(\"$ElementId\").style.display='block'; cript> S; eturn $pmsJS; } Function getCodeHideById_Pms($ElementId){ pmsJS= " "; * a function for qurey permission from Page_Permission table * * @param int $name_user * @param varchar $Page_Name * @param varchar $Page_Element_Id * @param varchar $Element_Type */ e_Name,$Page_Element_Id,$Element_Type) { QLpms= "SELECT User_Group_List.U_Group_List_id, user_admins_group.Group_p, user_admins_group.Group_Name, user_admins_group.is_del, Page_Permission.Page_Name, Page_Permission.Page_Element_Id, Page_Permission.Page_Action, Page_Permission.Page_Element_Name JOIN er_Group_List.id_user_admin INNER JOIN _Id = user_admins_group.User_Group_Id INNER JOIN Page_Permission ON user_admins_group.Group_p = Page_Permission.Group_p (Page_Permission.is_del = 0) And (User_Group_List.is_del = 0) And (user_admins.name_user = '$name_user') And (Page_Permission.Page_Name = '$Page_Name') ile ($row_rms= mssql_fetch_array($pmsQuery)){ $level_p_pms=$row_rms["name_user"]; $Page_Element_Id_Query=$row_rms["Page_Element_Id"]; $Page_Element_Name_Query=$row_rms["Page_Element_Name"]; ]; {$Permission_action=$row_rms["Page_Action"];} ($row_rms["Page_Element_Name"]) && !isset($row_rms["Page_Element_Id"])) ction=$row_rms["Page_Action"];} //echo $level_p_pms; echo $name_user; echo $Page_Action; echo $Page_Element_Id_Query; ){$this->getCodeShowById_Pms($Page_Element_Id_Query);} ction=='Edit'){$this->getCodeShowById_Pms($Page_Element_Id_Query);} n=='View'){$this->getCodeShowById_Pms($Page_Element_Id_Query);} * * A Function for hide element by element name -- JavaScript * * @global string * @param string $ElementId name for element Id * @return string $pmsJS code of javaScript */ t.getElementByName(\"$ElementId\").style.display='none'; * function hide element on page * ext $ar_eliment_list= array("PERCHASE_SYSTEM_MENU","SIGN_SYSTEM_MENU"); * Page_hide_Eliment_list($ar_eliment_list); * * @param array $ar_eliment_list * @return echo java script code */ function Page_hide_Eliment_list($ar_eliment_list){ echo "