|
|
|
รบกวนช่วยชี้แนะการตัดคำด้วยนะครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$Id_Dept = $_REQUEST["Rdo"];
$Schedule_Date = $_REQUEST["schedule_date"];
//*** Change Format JobSchedule ***//
$ExSchedule_Date = strtotime($Schedule_Date, 1198494000);
$ExScheduleDate = date('y-m-d', $ExSchedule_Date);
//*** END ***//
//*** Connect Database ***//
include "connect.php";
mysql_query("SET NAMES UTF8");
$strSQL = "SELECT * FROM jobdata
LEFT JOIN employee ON (jobdata.ID = employee.ID)
LEFT JOIN company ON (jobdata.Id_Company = company.Id_Company)
LEFT JOIN workprocess ON (jobdata.Id_Job = workprocess.Id_Job)
WHERE workprocess.Delivery = '$ExScheduleDate' ORDER BY Shipping ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
if($objQuery){
//*** Get Document Path ***//
$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp
//*** Excel Document Root ***//
$strFileName = "MyExcel.xls";
//*** Connect to Excel.Application ***//
$xlApp = new COM("Excel.Application");
$xlBook = $xlApp->Workbooks->Add();
$xlSheet1 = $xlBook->Worksheets(1);
$xlApp->Application->Visible = False;
//*** Create Sheet 1 ***//
$xlBook->Worksheets(1)->Name = "$Schedule_Date";
$xlBook->Worksheets(1)->Select;
//*** Cell Border ***//
//$xlApp->ActiveSheet->Range("A1:R1")->BORDERS(1)->Weight = 2;
$xlApp->ActiveSheet->Range("A2:O2")->BORDERS->Weight = 2;
//*** END ***//
//*** Insert Picture ***//
$xlApp->Cells(1,1)->Select();
$xlApp->ActiveSheet->Pictures->Insert($strPath."/Image/pic-frm/h_ReportImport.gif")->Select();
$xlApp->ActiveSheet->Cells(1,1)->ColumnWidth = 60.0;
$xlApp->ActiveSheet->Cells(1,1)->RowHeight = 60.0;
$xlApp->ActiveSheet->Cells(1,12)->Value = "Daily Import Schedule Date: $Schedule_Date";
$xlApp->ActiveSheet->Cells(1,12)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(1,12)->Font->Size = 30;
$xlApp->ActiveSheet->Cells(1,12)->Font->Italic = True;
$xlApp->ActiveSheet->Cells(1,12)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(1,12)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(1,12)->HorizontalAlignment = 4; //*** Center Column ***//
$xlApp->ActiveSheet->Range("A1:C1")->MergeCells = True;
$xlApp->ActiveSheet->Range("D1:O1")->MergeCells = True;
//*** END ***//
//*** Fix Header Colums ***//
//*** Width & Height (A2:A2) ***//
$xlApp->ActiveSheet->Range("A2:A2")->ColumnWidth = 5.0;
$xlApp->ActiveSheet->Range("A2:A2")->RowHeight = 20.0;
//*** Width & Height (B2:B2) ***//
$xlApp->ActiveSheet->Range("B2:B2")->ColumnWidth = 30.0;
$xlApp->ActiveSheet->Range("B2:B2")->RowHeight = 20.0;
//*** Width & Height (C2:C2) ***//
$xlApp->ActiveSheet->Range("C2:C2")->ColumnWidth = 30.0;
$xlApp->ActiveSheet->Range("C2:C2")->RowHeight = 20.0;
//*** Width & Height (D2:D2) ***//
$xlApp->ActiveSheet->Range("D2:D2")->ColumnWidth = 13.0;
$xlApp->ActiveSheet->Range("D2:D2")->RowHeight = 20.0;
//*** Width & Height (E2:E2) ***//
$xlApp->ActiveSheet->Range("E2:E2")->ColumnWidth = 8.0;
$xlApp->ActiveSheet->Range("E2:E2")->RowHeight = 20.0;
//*** Width & Height (F2:F2) ***//
$xlApp->ActiveSheet->Range("F2:F2")->ColumnWidth = 8.0;
$xlApp->ActiveSheet->Range("F2:F2")->RowHeight = 20.0;
//*** Width & Height (J2:J2) ***//
$xlApp->ActiveSheet->Range("G2:G2")->ColumnWidth = 5.0;
$xlApp->ActiveSheet->Range("G2:G2")->RowHeight = 20.0;
//*** Width & Height (K2:K2) ***//
$xlApp->ActiveSheet->Range("H2:H2")->ColumnWidth = 5.0;
$xlApp->ActiveSheet->Range("H2:H2")->RowHeight = 20.0;
//*** Width & Height (L2:L2) ***//
$xlApp->ActiveSheet->Range("I2:I2")->ColumnWidth = 10.0;
$xlApp->ActiveSheet->Range("I2:I2")->RowHeight = 20.0;
//*** Width & Height (M2:M2) ***//
$xlApp->ActiveSheet->Range("J2:J2")->ColumnWidth = 10.0;
$xlApp->ActiveSheet->Range("J2:J2")->RowHeight = 20.0;
//*** Width & Height (N2:N2) ***//
$xlApp->ActiveSheet->Range("K2:K2")->ColumnWidth = 8.0;
$xlApp->ActiveSheet->Range("K2:K2")->RowHeight = 20.0;
//*** Width & Height (O2:O2) ***//
$xlApp->ActiveSheet->Range("L2:L2")->ColumnWidth = 15.0;
$xlApp->ActiveSheet->Range("L2:L2")->RowHeight = 20.0;
//*** Width & Height (P2:P2) ***//
$xlApp->ActiveSheet->Range("M2:M2")->ColumnWidth = 10.0;
$xlApp->ActiveSheet->Range("M2:M2")->RowHeight = 20.0;
//*** Width & Height (Q2:Q2) ***//
$xlApp->ActiveSheet->Range("N2:N2")->ColumnWidth = 10.0;
$xlApp->ActiveSheet->Range("N2:N2")->RowHeight = 20.0;
//*** Width & Height (R2:R2) ***//
$xlApp->ActiveSheet->Range("O2:O2")->ColumnWidth = 20.0;
$xlApp->ActiveSheet->Range("O2:O2")->RowHeight = 20.0;
//*** END ***//
//*** Write text to Row 2 Column 1 ***//
$xlApp->ActiveSheet->Cells(2,1)->Value = "No.";
$xlApp->ActiveSheet->Cells(2,1)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,1)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,1)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,1)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,1)->Font->Size = 16;
//*** Write text to Row 2 Column 2 ***//
$xlApp->ActiveSheet->Cells(2,2)->Value = "Client";
$xlApp->ActiveSheet->Cells(2,2)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,2)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,2)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,2)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,2)->Font->Size = 16;
//*** Write text to Row 2 Column 3 ***//
$xlApp->ActiveSheet->Cells(2,3)->Value = "Invoice";
$xlApp->ActiveSheet->Cells(2,3)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,3)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,3)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,3)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,3)->Font->Size = 16;
//*** Write text to Row 2 Column 4 ***//
$xlApp->ActiveSheet->Cells(2,4)->Value = "FWDInChage";
$xlApp->ActiveSheet->Cells(2,4)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,4)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,4)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,4)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,4)->Font->Size = 16;
//*** Write text to Row 2 Column 5 ***//
$xlApp->ActiveSheet->Cells(2,5)->Value = "Mode";
$xlApp->ActiveSheet->Cells(2,5)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,5)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,5)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,5)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,5)->Font->Size = 16;
//*** Write text to Row 2 Column 6 ***//
$xlApp->ActiveSheet->Cells(2,6)->Value = "Type";
$xlApp->ActiveSheet->Cells(2,6)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,6)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,6)->Font->Size = 16;
//*** Write text to Row 2 Column 10 ***//
$xlApp->ActiveSheet->Cells(2,7)->Value = "20";
$xlApp->ActiveSheet->Cells(2,7)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,7)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,7)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,7)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,7)->Font->Size = 16;
//*** Write text to Row 2 Column 11 ***//
$xlApp->ActiveSheet->Cells(2,8)->Value = "40";
$xlApp->ActiveSheet->Cells(2,8)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,8)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,8)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,8)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,8)->Font->Size = 16;
//*** Write text to Row 2 Column 12 ***//
$xlApp->ActiveSheet->Cells(2,9)->Value = "Shipping";
$xlApp->ActiveSheet->Cells(2,9)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,9)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,9)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,9)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,9)->Font->Size = 16;
//*** Write text to Row 2 Column 13 ***//
$xlApp->ActiveSheet->Cells(2,10)->Value = "ETA";
$xlApp->ActiveSheet->Cells(2,10)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,10)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,10)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,10)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,10)->Font->Size = 16;
//*** Write text to Row 2 Column 14 ***//
$xlApp->ActiveSheet->Cells(2,11)->Value = "Port";
$xlApp->ActiveSheet->Cells(2,11)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,11)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,11)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,11)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,11)->Font->Size = 16;
//*** Write text to Row 2 Column 15 ***//
$xlApp->ActiveSheet->Cells(2,12)->Value = "Plan";
$xlApp->ActiveSheet->Cells(2,12)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,12)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,12)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,12)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,12)->Font->Size = 16;
//*** Write text to Row 2 Column 16 ***//
$xlApp->ActiveSheet->Cells(2,13)->Value = "Inspection";
$xlApp->ActiveSheet->Cells(2,13)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,13)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,13)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,13)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,13)->Font->Size = 16;
//*** Write text to Row 2 Column 17 ***//
$xlApp->ActiveSheet->Cells(2,14)->Value = "Transport";
$xlApp->ActiveSheet->Cells(2,14)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,14)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,14)->Font->Size = 16;
//*** Write text to Row 2 Column 18 ***//
$xlApp->ActiveSheet->Cells(2,15)->Value = "Remark";
$xlApp->ActiveSheet->Cells(2,15)->Font->Name = "Angsana New";
$xlApp->ActiveSheet->Cells(2,15)->Font->Bold = True;
$xlApp->ActiveSheet->Cells(2,15)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells(2,15)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells(2,15)->Font->Size = 16;
//*** END ***//
//*** Start Row 2 ***//
$intRows = 3;
$num = 0;
while($objResult = mysql_fetch_array($objQuery)){
//*** Tb:Company ***//
$Name_Company = $objResult["Name_Company"];
//*** END ***//
//*** Tb:Jobdata ***//
$Invoice = $objResult["Invoice"];
$Name_Staff = $objResult["Name"];
$Id_Container = $objResult["Id_Container"];
$Id_Container1 = $objResult["Id_Container1"];
$Qty = $objResult["Qty"];
$NW = $objResult["NW"];
$GW = $objResult["GW"];
$Type_Qty = $objResult["Type_Qty"];
$Type_NW = $objResult["Type_NW"];
$Type_GW = $objResult["Type_GW"];
$C_20 = $objResult["Container_20"];
$C_40 = $objResult["Container_40"];
$Type_20 = $objResult["Type_20"];
$Type_40 = $objResult["Type_40"];
$Name_Shipping = $objResult["Shipping"];
$ETA = $objResult["ETA"];
$Port = $objResult["Port"];
$Inspection = $objResult["Inspection"];
$Plan = $objResult["Plan"];
$Delivery_time = $objResult["Delivery_time"];
$Transport = $objResult["Transport"];
$Remark = $objResult["Remark"];
//*** Run Numbers 1 2 3 4 5 ... ***//
$num++;
//*** Show No. ***//
$xlApp->ActiveSheet->Cells($intRows,1)->Value = $num;
$xlApp->ActiveSheet->Cells($intRows,1)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,1)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,1)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,1)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,1)->RowHeight = 20.0;
//*** END ***//
//*** Show Name Company ***//
if($Name_Company == ""){
$xlApp->ActiveSheet->Cells($intRows,2)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,2)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,2)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,2)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,2)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,2)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,2)->RowHeight = 20.0;
}else{
//$ExName_Company = explode(" ",$Name_Company);
$ExName_Company = split("[(]",$Name_Company);
//$xlApp->ActiveSheet->Cells($intRows,2)->Value = $ExName_Company[0].$ExName_Company[1]." ".$ExName_Company[2];
$xlApp->ActiveSheet->Cells($intRows,2)->Value = $ExName_Company;
$xlApp->ActiveSheet->Cells($intRows,2)->VerticalAlignment = -4108; //*** Center Rows ***//
//$xlApp->ActiveSheet->Cells($intRows,2)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,2)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,2)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,2)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Invoice ***//
$xlApp->ActiveSheet->Cells($intRows,3)->Value = $Invoice;
$xlApp->ActiveSheet->Cells($intRows,3)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,3)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,3)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,3)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,3)->RowHeight = 20.0;
//*** END ***//
//*** Show Name Staff ***//
if($Name_Staff == ""){
$xlApp->ActiveSheet->Cells($intRows,4)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,4)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,4)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,4)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,4)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,4)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,4)->RowHeight = 20.0;
}else{
$ExName_Staff = explode(" ",$Name_Staff);
$xlApp->ActiveSheet->Cells($intRows,4)->Value = $ExName_Staff[0];
$xlApp->ActiveSheet->Cells($intRows,4)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,4)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,4)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,4)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,4)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Mode ***//
if($Id_Container == 1){
$xlApp->ActiveSheet->Cells($intRows,5)->Value = "LCL";
$xlApp->ActiveSheet->Cells($intRows,5)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,5)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,5)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,5)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,5)->RowHeight = 20.0;
}elseif($Id_Container == 2){
$xlApp->ActiveSheet->Cells($intRows,5)->Value = "FCL";
$xlApp->ActiveSheet->Cells($intRows,5)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,5)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,5)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,5)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,5)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,5)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,5)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,5)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,5)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,5)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,5)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,5)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Type ***//
if($Id_Container == 1 AND $Id_Container1 == 1){
$xlApp->ActiveSheet->Cells($intRows,6)->Value = "4W/H";
$xlApp->ActiveSheet->Cells($intRows,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,6)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,6)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,6)->RowHeight = 20.0;
}elseif($Id_Container == 1 AND $Id_Container1 == 2){
$xlApp->ActiveSheet->Cells($intRows,6)->Value = "6W/H";
$xlApp->ActiveSheet->Cells($intRows,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,6)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,6)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,6)->RowHeight = 20.0;
}elseif($Id_Container == 1 AND $Id_Container1 == 3){
$xlApp->ActiveSheet->Cells($intRows,6)->Value = "10W/H";
$xlApp->ActiveSheet->Cells($intRows,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,6)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,6)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,6)->RowHeight = 20.0;
}elseif($Id_Container == 1 AND $Id_Container1 == 4){
$xlApp->ActiveSheet->Cells($intRows,6)->Value = "Pickup";
$xlApp->ActiveSheet->Cells($intRows,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,6)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,6)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,6)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,6)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,6)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,6)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,6)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,6)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,6)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,6)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Total Container Size 20 ***//
if($C_20 == ""){
$xlApp->ActiveSheet->Cells($intRows,7)->Value = "$C_20";
$xlApp->ActiveSheet->Cells($intRows,7)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,7)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,7)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,7)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,7)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,7)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,7)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,7)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,7)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,7)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,7)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,7)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Total Container Size 40 ***//
if($C_40 == ""){
$xlApp->ActiveSheet->Cells($intRows,8)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,8)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,8)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,8)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,8)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,8)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,8)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,8)->Value = "$C_40";
$xlApp->ActiveSheet->Cells($intRows,8)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,8)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,8)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,8)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,8)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Name Shipping ***//
if($Name_Shipping == ""){
$xlApp->ActiveSheet->Cells($intRows,9)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,9)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,9)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,9)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,9)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,9)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,9)->RowHeight = 20.0;
}else{
$ExName_Shipping = explode(" ",$Name_Shipping);
$xlApp->ActiveSheet->Cells($intRows,9)->Value = $ExName_Shipping[0];
$xlApp->ActiveSheet->Cells($intRows,9)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,9)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,9)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,9)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,9)->RowHeight = 20.0;
}
//*** END ***//
//*** Show ETA ***//
if($ETA == ""){
$xlApp->ActiveSheet->Cells($intRows,10)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,10)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,10)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,10)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,10)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,10)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,10)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,10)->Value = $ETA;
$xlApp->ActiveSheet->Cells($intRows,10)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,10)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,10)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,10)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,10)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Port ***//
if($Port == ""){
$xlApp->ActiveSheet->Cells($intRows,11)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,11)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,11)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,11)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,11)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,11)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,11)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,11)->Value = $Port;
$xlApp->ActiveSheet->Cells($intRows,11)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,11)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,11)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,11)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,11)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Plan ***//
if($Plan == ""){
$xlApp->ActiveSheet->Cells($intRows,12)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,12)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,12)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,12)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,12)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,12)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,12)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,12)->Value = $Plan."/".$Delivery_time;
$xlApp->ActiveSheet->Cells($intRows,12)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,12)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,12)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,12)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,12)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Inspection ***//
if($Inspection == ""){
$xlApp->ActiveSheet->Cells($intRows,13)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,13)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,13)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,13)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,13)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,13)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,13)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,13)->Value = $Inspection;
$xlApp->ActiveSheet->Cells($intRows,13)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,13)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,13)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,13)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,13)->RowHeight = 20.0;
}
//*** END ***//
//*** Show Transport ***//
if($Transport == ""){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}else{
//*** Show Name Transport ***//
if($Transport == 1){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "SUPPAYA";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}elseif($Transport == 2){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "DRAGON";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}elseif($Transport == 3){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "TKLS";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}elseif($Transport == 4){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "GORRAGOD";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}elseif($Transport == 5){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "SLC TRANSPORT";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}elseif($Transport == 6){
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "TBCS";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}else{
$xlApp->ActiveSheet->Cells($intRows,14)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,14)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,14)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,14)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,14)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,14)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,14)->RowHeight = 20.0;
}
}
//*** END ***//
//*** Show Remark ***//
if($Remark == ""){
$xlApp->ActiveSheet->Cells($intRows,15)->Value = "-";
$xlApp->ActiveSheet->Cells($intRows,15)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,15)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,15)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,15)->Font->ColorIndex = 3;
$xlApp->ActiveSheet->Cells($intRows,15)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,15)->RowHeight = 20.0;
}else{
$Remark = iconv('UTF-8', 'TIS-620', $Remark);
$xlApp->ActiveSheet->Cells($intRows,15)->Value = $Remark;
$xlApp->ActiveSheet->Cells($intRows,15)->VerticalAlignment = -4108; //*** Center Rows ***//
$xlApp->ActiveSheet->Cells($intRows,15)->HorizontalAlignment = -4108; //*** Center Column ***//
$xlApp->ActiveSheet->Cells($intRows,15)->Font->Size = 10;
$xlApp->ActiveSheet->Cells($intRows,15)->BORDERS->Weight = 2;
$xlApp->ActiveSheet->Cells($intRows,15)->RowHeight = 20.0;
}
//*** END ***//
$intRows++;
}
@unlink($strFileName); //*** Delete old files ***//
$xlBook->SaveAs($strPath."/".$strFileName); //*** Save to Path ***//
//$xlBook->SaveAs(realpath($strFileName)); //*** Save to Path ***//
//*** Close & Quit ***//
$xlApp->Application->Quit();
$xlApp = null;
$xlBook = null;
$xlSheet1 = null;
}
?>
คือตอนนี้ ผม ใช้ split ตัดคำได้ ปกติ ครับ แต่ ปัญหา ยัง ไม่จบครับ อย่างเช่น
1.Company (THAILAND) CO.,LTD.
2.Company (THAILAND) CO.,LTD
3.Company CO.,LTD
คือตอนนี้ ถ้าใช้ split ตัด ก็จะ เหลือ คือ CO.,LTD. หรือ CO.,LTD
อยากจะตัด คำ CO.,LTD. หรือ CO.,LTD ต่อยังไงดีครับผม รบกวน พี่ๆ แนะ นำ ด้วยนะครับ ผม
Tag : PHP, MySQL, JavaScript, Excel (Excel.Application)
|
|
|
|
|
|
Date :
2011-06-18 10:54:28 |
By :
popnakub |
View :
941 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
การตัดคำก็ใช้คำสั่ง sub_str() ซิ แล้วแต่ว่าจะกำหนดให้เอากี่คำ
|
|
|
|
|
Date :
2011-06-18 11:56:20 |
By :
a |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เลอกเอาตามใจชอบเลยครับ Function เกี่ยวกับ Char ทั้งนั้น
|
|
|
|
|
Date :
2011-06-18 12:01:34 |
By :
bluesix |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|