update tracking

This commit is contained in:
franknstayn
2022-01-22 22:30:45 +08:00
parent e54f9e7db6
commit 65123a7ccf
7 changed files with 655 additions and 320 deletions

View File

@@ -11,6 +11,12 @@ use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
// use Validator; // use Validator;
use App\User; use App\User;
use Illuminate\Support\Facades\Session;
use Excel;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
class AdminController extends Controller class AdminController extends Controller
@@ -1341,4 +1347,54 @@ class AdminController extends Controller
} }
return view('admin_pages.tracking_index')->with("tracking", $getTrackingStatus); return view('admin_pages.tracking_index')->with("tracking", $getTrackingStatus);
} }
public function importExcel(Request $request){
//validate the xls file
$this->validate($request, array(
'file' => 'required'
));
if($request->hasFile('file')){
$extension = File::extension($request->file->getClientOriginalName());
if ($extension == "xlsx" || $extension == "xls" || $extension == "csv") {
$path = $request->file->getRealPath();
$data = Excel::load($path, function($reader) {
})->get();
if(!empty($data) && $data->count()){
// var_dump($data);
foreach ($data as $key => $value) {
$insert[] = [
'TrackingNumber' => $value->tracking_number,
'InvoiceNumber' => $value->invoice_number,
'Carrier' => $value->carrier,
'StepId' => 10,
'ScannedBy' => 1,
'created_at'=> Carbon::now()
];
}
if(!empty($insert)){
$insertData = DB::table('tracking')->insert($insert);
if ($insertData) {
Session::flash('success', 'Your Data has successfully imported');
}else {
Session::flash('error', 'Error inserting the data..');
return back();
}
}
}
return back();
}else {
Session::flash('error', 'File is a '.$extension.' file.!! Please upload a valid xls/csv file..!!');
return back();
}
}
}
} }

View File

@@ -92,6 +92,8 @@ Route::group(['middleware' => 'auth'], function () {
Route::get('tracking', 'admin\AdminController@trackingIndex'); Route::get('tracking', 'admin\AdminController@trackingIndex');
Route::post('post/update-hibernate', 'admin\AdminController@updateHibernate'); Route::post('post/update-hibernate', 'admin\AdminController@updateHibernate');
Route::post('import', 'admin\AdminController@importExcel')->name('import');
Route::get('duplicate-store/{id}/{newstore_id}', 'admin\AdminController@duplicateStore' ); Route::get('duplicate-store/{id}/{newstore_id}', 'admin\AdminController@duplicateStore' );

View File

@@ -7,7 +7,8 @@ use Illuminate\Support\Facades\DB;
class AdminModel extends Model class AdminModel extends Model
{ {
function selectPaymentDetails($field, $value){ function selectPaymentDetails($field, $value)
{
if ($field != "All") { if ($field != "All") {
$i = DB::table('payment_details') $i = DB::table('payment_details')
@@ -29,23 +30,25 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectOrderItem($field, $ck){ function selectOrderItem($field, $ck)
{
$i = DB::table('orders') $i = DB::table('orders')
->where($field, $ck) ->where($field, $ck)
->get(); ->get();
return $i; return $i;
} }
function itemGroup($cartKey){ function itemGroup($cartKey)
{
$pdo = DB::connection()->getPdo(); $pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT orders.*, COUNT(orders.Id) AS qty, orders.Price * SUM(orders.Quantity) AS total_price, teamstores.StoreName FROM orders LEFT JOIN teamstores on teamstores.Id = orders.StoreId WHERE CartKey = :ck GROUP BY ProductId"); $query = $pdo->prepare("SELECT orders.*, COUNT(orders.Id) AS qty, orders.Price * SUM(orders.Quantity) AS total_price, teamstores.StoreName FROM orders LEFT JOIN teamstores on teamstores.Id = orders.StoreId WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck' => $cartKey]); $query->execute([':ck' => $cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ); $row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row; return $row;
} }
function selectDisplayItemThumb(){ function selectDisplayItemThumb()
{
$i = DB::table('teamstore_product_thumbnails') $i = DB::table('teamstore_product_thumbnails')
->where('ImageClass', 'active') ->where('ImageClass', 'active')
@@ -53,7 +56,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectShippingAddress($field, $value){ function selectShippingAddress($field, $value)
{
$i = DB::table('shipping_addresses') $i = DB::table('shipping_addresses')
->where($field, $value) ->where($field, $value)
@@ -61,27 +65,31 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectClientDesign($design_code){ function selectClientDesign($design_code)
{
$i = DB::table('client_designs') $i = DB::table('client_designs')
->where('DesignCode', $design_code) ->where('DesignCode', $design_code)
->get(); ->get();
return $i; return $i;
} }
function insertTeamstore($data){ function insertTeamstore($data)
{
$i = DB::table('teamstores')->insert($data); $i = DB::table('teamstores')->insert($data);
return $i; return $i;
} }
function selectTeamstore(){ function selectTeamstore()
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->paginate(16); ->paginate(16);
return $i; return $i;
} }
function selectTeamstoreFilter($field, $value){ function selectTeamstoreFilter($field, $value)
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->orderby($field, $value) ->orderby($field, $value)
@@ -89,7 +97,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectTeamstoreSearch($field, $value, $keyword){ function selectTeamstoreSearch($field, $value, $keyword)
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->where("StoreName", "LIKE", "%$keyword%") ->where("StoreName", "LIKE", "%$keyword%")
@@ -98,7 +107,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectTeamstoreById($id){ function selectTeamstoreById($id)
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->where("Id", $id) ->where("Id", $id)
@@ -106,7 +116,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function updateTeamstore($id, $data){ function updateTeamstore($id, $data)
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->where("Id", $id) ->where("Id", $id)
@@ -114,7 +125,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deleteTeamstoreById($id){ function deleteTeamstoreById($id)
{
$i = DB::table('teamstores') $i = DB::table('teamstores')
->where("Id", $id) ->where("Id", $id)
@@ -122,14 +134,16 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectPattern(){ function selectPattern()
{
$i = DB::table('patterns') $i = DB::table('patterns')
->get(); ->get();
return $i; return $i;
} }
function selectPatternWithfield($field, $value){ function selectPatternWithfield($field, $value)
{
$i = DB::table('patterns') $i = DB::table('patterns')
->where($field, $value) ->where($field, $value)
@@ -137,7 +151,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectClipartCategory(){ function selectClipartCategory()
{
$i = DB::table('clipart_categories') $i = DB::table('clipart_categories')
->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id')
->select('clipart_categories.*', 'user_logins.username') ->select('clipart_categories.*', 'user_logins.username')
@@ -146,7 +161,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function ClipartCategory(){ function ClipartCategory()
{
$i = DB::table('clipart_categories') $i = DB::table('clipart_categories')
->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id')
->select('clipart_categories.*', 'user_logins.username') ->select('clipart_categories.*', 'user_logins.username')
@@ -155,7 +171,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectStoreOwners($store_id){ function selectStoreOwners($store_id)
{
$i = DB::table('user_logins') $i = DB::table('user_logins')
->where('role', 'store_owner') ->where('role', 'store_owner')
->where('store_id', $store_id) ->where('store_id', $store_id)
@@ -163,25 +180,29 @@ class AdminModel extends Model
return $i; return $i;
} }
function insertClipartCategory($data){ function insertClipartCategory($data)
{
$i = DB::table('clipart_categories')->insertGetId($data); $i = DB::table('clipart_categories')->insertGetId($data);
return $i; return $i;
} }
function insertClipart($data){ function insertClipart($data)
{
$i = DB::table('cliparts')->insert($data); $i = DB::table('cliparts')->insert($data);
return $i; return $i;
} }
function updateClipartCatOrdering($order, $id){ function updateClipartCatOrdering($order, $id)
{
$i = DB::table('clipart_categories')->where('Id', $id) $i = DB::table('clipart_categories')->where('Id', $id)
->update(['Ordering' => $order]); ->update(['Ordering' => $order]);
} }
function userList(){ function userList()
{
$i = DB::table('user_logins') $i = DB::table('user_logins')
->select('id', 'name', 'username', 'email') ->select('id', 'name', 'username', 'email')
// ->where("name", "LIKE","%$keyword%") // ->where("name", "LIKE","%$keyword%")
@@ -193,7 +214,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function makeUserAsStoreOwner($data){ function makeUserAsStoreOwner($data)
{
$i = DB::table('user_logins') $i = DB::table('user_logins')
->where("Id", $data['user_id']) ->where("Id", $data['user_id'])
@@ -201,14 +223,16 @@ class AdminModel extends Model
return $i; return $i;
} }
function model_removeStoreAccess($data){ function model_removeStoreAccess($data)
{
$i = DB::table('user_logins') $i = DB::table('user_logins')
->where("Id", $data['user_id']) ->where("Id", $data['user_id'])
->update(['role' => 'user', 'store_id' => $data['store_id']]); ->update(['role' => 'user', 'store_id' => $data['store_id']]);
return $i; return $i;
} }
function deleteClipartCategory($id){ function deleteClipartCategory($id)
{
$i = DB::table('clipart_categories') $i = DB::table('clipart_categories')
->where("Id", $id) ->where("Id", $id)
@@ -216,7 +240,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deleteClipart($id){ function deleteClipart($id)
{
$i = DB::table('cliparts') $i = DB::table('cliparts')
->where("Id", $id) ->where("Id", $id)
@@ -224,7 +249,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function updateClipartCategory($id, $data){ function updateClipartCategory($id, $data)
{
$i = DB::table('clipart_categories') $i = DB::table('clipart_categories')
->where("Id", $id) ->where("Id", $id)
@@ -232,7 +258,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectCliparts($cat_id){ function selectCliparts($cat_id)
{
if ($cat_id != 0 || $cat_id != "") { if ($cat_id != 0 || $cat_id != "") {
$i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName') $i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName')
@@ -249,13 +276,10 @@ class AdminModel extends Model
->paginate(16); ->paginate(16);
return $i; return $i;
} }
} }
function selectSports(){ function selectSports()
{
$i = DB::table('sports') $i = DB::table('sports')
->orderby("SportsName", "ASC") ->orderby("SportsName", "ASC")
@@ -263,7 +287,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectSportsCategory($id){ function selectSportsCategory($id)
{
$i = DB::table('template_categories') $i = DB::table('template_categories')
->where('TemplateId', $id) ->where('TemplateId', $id)
@@ -272,7 +297,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectStoreOrders(){ function selectStoreOrders()
{
$i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'orders.DateCreated AS date_ordered', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'teamstores.*') $i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'orders.DateCreated AS date_ordered', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'teamstores.*')
->leftjoin('payment_details', 'payment_details.CartKey', '=', 'orders.CartKey') ->leftjoin('payment_details', 'payment_details.CartKey', '=', 'orders.CartKey')
->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id', '=', 'payment_details.Id') ->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id', '=', 'payment_details.Id')
@@ -283,7 +309,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function saveNewVisualizer($data){ function saveNewVisualizer($data)
{
$i = DB::table('templates')->insert($data); $i = DB::table('templates')->insert($data);
$id = DB::getPdo()->lastInsertId(); $id = DB::getPdo()->lastInsertId();
@@ -293,7 +320,8 @@ class AdminModel extends Model
); );
} }
function updateVisualizer($id, $data){ function updateVisualizer($id, $data)
{
$i = DB::table('templates') $i = DB::table('templates')
->where("Id", $id) ->where("Id", $id)
@@ -301,23 +329,27 @@ class AdminModel extends Model
return $i; return $i;
} }
function saveVisualizerDefaultBodyColor($data){ function saveVisualizerDefaultBodyColor($data)
{
$i = DB::table('template_body_colors')->insert($data); $i = DB::table('template_body_colors')->insert($data);
return $i; return $i;
} }
function saveVisualizerDefaultTrimColor($data){ function saveVisualizerDefaultTrimColor($data)
{
$i = DB::table('template_trim_colors')->insert($data); $i = DB::table('template_trim_colors')->insert($data);
return $i; return $i;
} }
function saveVisualizerPath($data){ function saveVisualizerPath($data)
{
$i = DB::table('template_paths')->insert($data); $i = DB::table('template_paths')->insert($data);
return $i; return $i;
} }
function selectVisualizer($sports_id, $sports_category){ function selectVisualizer($sports_id, $sports_category)
{
$i = DB::table('templates') $i = DB::table('templates')
->where('SportsId', $sports_id) ->where('SportsId', $sports_id)
->where('Category', $sports_category) ->where('Category', $sports_category)
@@ -326,7 +358,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectDisplayItemThumbById($id){ function selectDisplayItemThumbById($id)
{
$i = DB::table('teamstore_product_thumbnails') $i = DB::table('teamstore_product_thumbnails')
->where('ProductId', $id) ->where('ProductId', $id)
@@ -335,14 +368,16 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectOrder($field, $value){ function selectOrder($field, $value)
{
$i = DB::table('orders') $i = DB::table('orders')
->where($field, $value) ->where($field, $value)
->get(); ->get();
return $i; return $i;
} }
function editVisualizer($id){ function editVisualizer($id)
{
$i = DB::table('templates') $i = DB::table('templates')
->where('Id', $id) ->where('Id', $id)
->get(); ->get();
@@ -350,7 +385,8 @@ class AdminModel extends Model
} }
function deleteVisualizer($id){ function deleteVisualizer($id)
{
$i = DB::table('templates') $i = DB::table('templates')
->where("Id", $id) ->where("Id", $id)
@@ -358,7 +394,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deleteDefaultBodyColor($tempCode){ function deleteDefaultBodyColor($tempCode)
{
$i = DB::table('template_body_colors') $i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -366,7 +403,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deleteTemplatePath($tempCode){ function deleteTemplatePath($tempCode)
{
$i = DB::table('template_paths') $i = DB::table('template_paths')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -374,7 +412,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deleteDefaultTrimColor($tempCode){ function deleteDefaultTrimColor($tempCode)
{
$i = DB::table('template_trim_colors') $i = DB::table('template_trim_colors')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -382,7 +421,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function deletePrintPatternList($tempCode){ function deletePrintPatternList($tempCode)
{
$i = DB::table('print_pattern_list') $i = DB::table('print_pattern_list')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -390,7 +430,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectTemplatePath($tempCode){ function selectTemplatePath($tempCode)
{
$i = DB::table('template_paths') $i = DB::table('template_paths')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -398,7 +439,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectDefaultBodyColor($tempCode){ function selectDefaultBodyColor($tempCode)
{
$i = DB::table('template_body_colors') $i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -406,7 +448,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectDefaultTrimColor($tempCode){ function selectDefaultTrimColor($tempCode)
{
$i = DB::table('template_trim_colors') $i = DB::table('template_trim_colors')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -414,7 +457,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function updateDefaultBodyColor($tempCode, $data){ function updateDefaultBodyColor($tempCode, $data)
{
$i = DB::table('template_body_colors') $i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode) ->where("TemplateCode", $tempCode)
@@ -422,7 +466,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function updateVisualizerPath($id, $data){ function updateVisualizerPath($id, $data)
{
$i = DB::table('template_paths') $i = DB::table('template_paths')
->where("Id", $id) ->where("Id", $id)
@@ -430,7 +475,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectCommission(){ function selectCommission()
{
$i = DB::select("SELECT t.StoreName, pd.InvoiceNumber, pd.CartKey, pd.Total, pd.SubTotal, pd.Tax, pd.Currency, pd.ShippingCost, $i = DB::select("SELECT t.StoreName, pd.InvoiceNumber, pd.CartKey, pd.Total, pd.SubTotal, pd.Tax, pd.Currency, pd.ShippingCost,
(pd.Total * 0.029) AS proc_fee, (pd.Total * 0.029) AS proc_fee,
(pd.SubTotal - 0.29) AS trans_rate, ROUND((( (pd.SubTotal - 0.29) AS trans_rate, ROUND(((
@@ -447,7 +493,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectVisualizerPrint(){ function selectVisualizerPrint()
{
$i = DB::select("SELECT t.TemplateCode, t.Thumbnail, t.TemplateName, t.IsActive, $i = DB::select("SELECT t.TemplateCode, t.Thumbnail, t.TemplateName, t.IsActive,
s.SportsName, tc.Category s.SportsName, tc.Category
FROM templates AS t FROM templates AS t
@@ -457,13 +504,15 @@ class AdminModel extends Model
return $i; return $i;
} }
function insertPrintFiles($data){ function insertPrintFiles($data)
{
$i = DB::table('print_pattern_list')->insert($data); $i = DB::table('print_pattern_list')->insert($data);
return $i; return $i;
} }
function selectGroupPrintFiles(){ function selectGroupPrintFiles()
{
$i = DB::select("SELECT ppl.TemplateCode, t.TemplateName, s.SportsName, tc.Category $i = DB::select("SELECT ppl.TemplateCode, t.TemplateName, s.SportsName, tc.Category
FROM print_pattern_list AS ppl FROM print_pattern_list AS ppl
INNER JOIN templates AS t ON t.TemplateCode = ppl.TemplateCode INNER JOIN templates AS t ON t.TemplateCode = ppl.TemplateCode
@@ -474,7 +523,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectPrintFiles($tempCode){ function selectPrintFiles($tempCode)
{
$i = DB::select("SELECT t.TemplateName, ppl.Id, ppl.Path, ppl.`Type`, ppl.Size from templates AS t $i = DB::select("SELECT t.TemplateName, ppl.Id, ppl.Path, ppl.`Type`, ppl.Size from templates AS t
INNER JOIN print_pattern_list AS ppl ON ppl.TemplateCode = t.TemplateCode INNER JOIN print_pattern_list AS ppl ON ppl.TemplateCode = t.TemplateCode
WHERE t.TemplateCode = '$tempCode' WHERE t.TemplateCode = '$tempCode'
@@ -483,21 +533,24 @@ class AdminModel extends Model
return $i; return $i;
} }
function deletePrintFiles($id){ function deletePrintFiles($id)
{
$i = DB::table('print_pattern_list') $i = DB::table('print_pattern_list')
->where("Id", $id) ->where("Id", $id)
->delete(); ->delete();
return $i; return $i;
} }
function selectTax(){ function selectTax()
{
$i = DB::select("SELECT t.Id, t.StoreName, tx.DateCreated FROM tax AS tx $i = DB::select("SELECT t.Id, t.StoreName, tx.DateCreated FROM tax AS tx
INNER JOIN teamstores AS t INNER JOIN teamstores AS t
ON t.Id = tx.TeamstoreId"); ON t.Id = tx.TeamstoreId");
return $i; return $i;
} }
function selectTeamstoreProducts($field, $value){ function selectTeamstoreProducts($field, $value)
{
$i = DB::table('teamstore_products') $i = DB::table('teamstore_products')
->where($field, $value) ->where($field, $value)
@@ -505,7 +558,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function selectProductThumbnail($id){ function selectProductThumbnail($id)
{
$i = DB::table('teamstore_product_thumbnails') $i = DB::table('teamstore_product_thumbnails')
->where('ProductId', $id) ->where('ProductId', $id)
@@ -513,7 +567,8 @@ class AdminModel extends Model
return $i; return $i;
} }
function insertStoreItem($data){ function insertStoreItem($data)
{
$i = DB::table('teamstore_products')->insert($data); $i = DB::table('teamstore_products')->insert($data);
var_dump($i); var_dump($i);
@@ -525,7 +580,8 @@ class AdminModel extends Model
); );
} }
function insertProductThumbnails($data){ function insertProductThumbnails($data)
{
$i = DB::table('teamstore_product_thumbnails')->insert($data); $i = DB::table('teamstore_product_thumbnails')->insert($data);
// $id = DB::getPdo()->lastInsertId(); // $id = DB::getPdo()->lastInsertId();
@@ -534,14 +590,15 @@ class AdminModel extends Model
} }
function getTrackingStatus($invoice) { function getTrackingStatus($invoice)
$i = DB::select("SELECT t.InvoiceNumber, ts.StepLabel, pu.Name, DATE_FORMAT(t.created_at, '%m/%d/%Y %h:%i:%s %p') AS DateCreated {
$i = DB::select("SELECT t.InvoiceNumber, t.Carrier, t.TrackingNumber, t.StepId, ts.StepLabel, pu.Name, DATE_FORMAT(t.created_at, '%m/%d/%Y %h:%i:%s %p') AS DateCreated, c.Link
FROM tracking AS t FROM tracking AS t
INNER JOIN tracking_steps AS ts ON ts.Id = t.StepId INNER JOIN tracking_steps AS ts ON ts.Id = t.StepId
LEFT JOIN carriers AS c ON c.Carrier = t.Carrier
INNER JOIN production_user AS pu ON t.ScannedBy = pu.Id INNER JOIN production_user AS pu ON t.ScannedBy = pu.Id
WHERE t.InvoiceNumber = '$invoice'"); WHERE t.InvoiceNumber = '$invoice'");
return $i; return $i;
} }
} }

View File

@@ -7,7 +7,8 @@
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"laravel/framework": "5.2.*", "laravel/framework": "5.2.*",
"league/flysystem-sftp": "1.0.22" "league/flysystem-sftp": "1.0.22",
"maatwebsite/excel": "~2.1.0"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",

310
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "af8d6f68d559b9573b148063cd25b63b", "content-hash": "0c83aa17d25e2e7ba255790fb4221ff1",
"packages": [ "packages": [
{ {
"name": "classpreloader/classpreloader", "name": "classpreloader/classpreloader",
@@ -564,6 +564,88 @@
}, },
"time": "2019-10-16T20:05:49+00:00" "time": "2019-10-16T20:05:49+00:00"
}, },
{
"name": "maatwebsite/excel",
"version": "2.1.30",
"source": {
"type": "git",
"url": "https://github.com/Maatwebsite/Laravel-Excel.git",
"reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/f5540c4ba3ac50cebd98b09ca42e61f926ef299f",
"reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f",
"shasum": ""
},
"require": {
"illuminate/cache": "^5.0",
"illuminate/config": "^5.0",
"illuminate/filesystem": "^5.0",
"illuminate/support": "^5.0",
"jeremeamia/superclosure": "^2.3",
"nesbot/carbon": "~1.0",
"php": ">=5.5",
"phpoffice/phpexcel": "^1.8.1",
"tijsverkoyen/css-to-inline-styles": "~2.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"orchestra/testbench": "3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*",
"phpseclib/phpseclib": "~1.0",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"illuminate/http": "^5.0",
"illuminate/queue": "^5.0",
"illuminate/routing": "^5.0",
"illuminate/view": "^5.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Maatwebsite\\Excel\\ExcelServiceProvider"
],
"aliases": {
"Excel": "Maatwebsite\\Excel\\Facades\\Excel"
}
}
},
"autoload": {
"classmap": [
"src/Maatwebsite/Excel"
],
"psr-0": {
"Maatwebsite\\Excel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maatwebsite.nl",
"email": "patrick@maatwebsite.nl"
}
],
"description": "Supercharged Excel exports in Laravel",
"keywords": [
"PHPExcel",
"batch",
"csv",
"excel",
"export",
"import",
"laravel"
],
"support": {
"issues": "https://github.com/Maatwebsite/Laravel-Excel/issues",
"source": "https://github.com/Maatwebsite/Laravel-Excel/tree/2.1"
},
"time": "2018-09-04T19:00:09+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "1.24.0", "version": "1.24.0",
@@ -843,6 +925,73 @@
], ],
"time": "2018-04-04T21:48:54+00:00" "time": "2018-04-04T21:48:54+00:00"
}, },
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": "^5.2|^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PHPExcel",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PHPExcel/issues",
"source": "https://github.com/PHPOffice/PHPExcel/tree/master"
},
"abandoned": "phpoffice/phpspreadsheet",
"time": "2018-11-22T23:07:24+00:00"
},
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
"version": "2.0.32", "version": "2.0.32",
@@ -1185,6 +1334,59 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-30T07:22:48+00:00" "time": "2016-07-30T07:22:48+00:00"
}, },
{
"name": "symfony/css-selector",
"version": "v3.0.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/b8999c1f33c224b2b66b38253f5e3a838d0d0115",
"reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2016-06-29T05:40:00+00:00"
},
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.0.9", "version": "v3.0.9",
@@ -1965,6 +2167,59 @@
], ],
"time": "2016-07-26T08:03:56+00:00" "time": "2016-07-26T08:03:56+00:00"
}, },
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
"reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c",
"reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"php": "^5.5 || ^7.0 || ^8.0",
"symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"psr-4": {
"TijsVerkoyen\\CssToInlineStyles\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Tijs Verkoyen",
"email": "css_to_inline_styles@verkoyen.eu",
"role": "Developer"
}
],
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"support": {
"issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues",
"source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4"
},
"time": "2021-12-08T09:12:39+00:00"
},
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
"version": "v2.6.1", "version": "v2.6.1",
@@ -3190,59 +3445,6 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21T13:59:46+00:00" "time": "2015-06-21T13:59:46+00:00"
}, },
{
"name": "symfony/css-selector",
"version": "v3.0.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/b8999c1f33c224b2b66b38253f5e3a838d0d0115",
"reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2016-06-29T05:40:00+00:00"
},
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
"version": "v3.0.9", "version": "v3.0.9",

View File

@@ -147,6 +147,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class, Illuminate\View\ViewServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
/* /*
* Application Service Providers... * Application Service Providers...
@@ -201,6 +202,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class, 'View' => Illuminate\Support\Facades\View::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
], ],

View File

@@ -40,6 +40,13 @@
<div id="store_filter"></div> <div id="store_filter"></div>
</div> </div>
</div> --}} </div> --}}
<form action="{{ route('import') }}" method="POST" enctype="multipart/form-data">
{{ csrf_field() }}
Choose your xls/csv File : <input type="file" name="file" class="form-control">
<input type="submit" class="btn btn-primary btn-lg" style="margin-top: 3%">
</form>
<div class="col-md-12" style="margin-bottom: 20px"> <div class="col-md-12" style="margin-bottom: 20px">
<form action="{{ url('admin/tracking') }}"> <form action="{{ url('admin/tracking') }}">
<div class="input-group"> <div class="input-group">
@@ -70,7 +77,15 @@
@foreach ($tracking as $track) @foreach ($tracking as $track)
<tr> <tr>
<td>{{ $track->InvoiceNumber }}</td> <td>{{ $track->InvoiceNumber }}</td>
@if ($track->StepId == 10)
<td>{{ $track->StepLabel }} via {{ $track->Carrier }}
<a href="{{ $track->Link . $track->TrackingNumber }}" target="_blank">Click here.</a>
</td>
@else
<td>{{ $track->StepLabel }}</td> <td>{{ $track->StepLabel }}</td>
@endif
<td>{{ $track->Name }}</td> <td>{{ $track->Name }}</td>
<td>{{ $track->DateCreated }}</td> <td>{{ $track->DateCreated }}</td>