Creating shipping CSV
This commit is contained in:
@@ -19,12 +19,15 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a class="btn btn-success" href="<?=self::getUrl("Cpeshipping/History")?>">History anzeigen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">CPE Versand</h4>
|
||||
</div>
|
||||
<h4 class="header-title">CPE Versand</h4>
|
||||
|
||||
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
||||
<nav>
|
||||
@@ -58,7 +61,8 @@
|
||||
<form method="post" action="<?=self::getUrl("Cpeshipping", "ship")?>">
|
||||
<table class="table table-striped table-hover">
|
||||
<tr>
|
||||
<th class="text-center"><input type="checkbox" id="checkAll" class="form-control" /></th>
|
||||
<th class="text-center">Versand<br /><input type="checkbox" id="checkAll" class="form-control" /></th>
|
||||
<th class="text-center">Externes Produkt<br />bestellt</th>
|
||||
<th>Kundennummer</th>
|
||||
<th>Kunde</th>
|
||||
<th>Lieferort</th>
|
||||
@@ -66,7 +70,14 @@
|
||||
</tr>
|
||||
<?php foreach($cpeprovisionings as $c): ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="form-control" name="ships[]" value="<?=$c->id?>" /></td>
|
||||
<td class="versand-checkbox text-center"><input type="checkbox" class="form-control" name="ships[]" value="<?=$c->id?>" /></td>
|
||||
<td class="text-center">
|
||||
<?php if(array_key_exists("hostnetwork_order", $c->orderproduct->product->attributes) && $c->orderproduct->product->attributes['hostnetwork_order']->value): ?>
|
||||
<input type="checkbox" class="form-control" name="external_finish-<?=$c->id?>" value="1" />
|
||||
<?php else: ?>
|
||||
n/a
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?=$c->order->owner->customer_number?></td>
|
||||
<td><?=$c->order->owner->getCompanyOrName()?></td>
|
||||
<td><?=($c->termination_id) ? $c->termination->building->zip." ".$c->termination->building->city : $c->order->owner->zip." ".$c->order->owner->city?></td>
|
||||
@@ -120,7 +131,7 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#checkAll").click(function() {
|
||||
$('input:checkbox').not(this).prop('checked', this.checked);
|
||||
$('.versand-checkbox input:checkbox').not(this).prop('checked', this.checked);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
8
Layout/default/Cpeshipping/csv/dhl.csv.php
Normal file
8
Layout/default/Cpeshipping/csv/dhl.csv.php
Normal file
@@ -0,0 +1,8 @@
|
||||
"Kontakt (Shipper)";"Firmenanme (Shipper)";"Adresszeile 1 (Shipper)";"City name (Shipper)";"PLZ (Shipper)";"Country Code (Shipper)";"Email (Shipper)";"Phone type (Shipper)";"Phone Country Code (Shipper)";"Phone Number (Shipper)";"Firmename (Receiver)";"Kontakt (Receiver)";"Adresszeile 1 (Receiver)";"City name (Receiver)";"Country Code (Receiver)";"PLZ (Receiver)";"Phone Type (Receiver)";"Phone Country Code (Receiver)";"Phone Number (Receiver)";"Shipment Date (YYYYMMDD)";"Account Number (Shipper)";"Accoun Number (Payer)";"Accoun Number (Duty&Tax)";"Total Shipment Pieces";"Weight";"Lenght";"Weith ";"Hight";"Product Code (three digits)";"Declared Value Currency";"Declared Value";"Summary of Contents";"Product Type";"Reference 1";"Email Address Receiver";"Email Address (shipment notification)";"Delivered Duty Paid";"Neutral Delivery";"Saturday Delivery";"Extended Liability";"Insured Value Currency";"Insured Value"
|
||||
<?php
|
||||
foreach($shippings as $ship):
|
||||
$order = $ship->order;
|
||||
$owner = $order->owner;
|
||||
?>
|
||||
"<?=$me->username?>";XINON GmbH;Fladnitz 150;Studenzen;8322;AT;office@xinon.at;O;43;311540800;"<?=$owner->company?>";"<?=$owner->getFullName()?>";"<?=($ship->termination_id) ? $ship->termination->building->street : $owner->street?>";"<?=$owner->city?>";AT;<?=($ship->termination_id) ? $ship->termination->building->zip : $owner->zip?>;0;<?=$owner->splitPhoneNumber()[0]?>;<?=$owner->splitPhoneNumber()[1]?>;;170863186;;;1;<?=$ship->ship_weight?>;<?=$ship->ship_length?>;<?=$ship->ship_width?>;<?=$ship->ship_height?>;DOM;EUR;;"Ware, not restricted";P;<?=$owner->customer_number?>;"<?=$owner->email?>";office@xinon.at;;;N;N;;
|
||||
<?php endforeach; ?>
|
||||
@@ -192,7 +192,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="order-detail-<?=$order->id?>" class="hidden" style="background-color:#fff">
|
||||
<tr id="order-detail-<?=$order->id?>" class="hidden" style="background-color:#cddef7">
|
||||
<td colspan="8">
|
||||
|
||||
<div class="card">
|
||||
|
||||
@@ -7,6 +7,7 @@ class Address extends mfBaseModel {
|
||||
private $attributes;
|
||||
private $permissions;
|
||||
|
||||
private $phoneparts;
|
||||
|
||||
public function getFullName() {
|
||||
// Assumes "Firma1 Firma2" or "firstname lastname" as readable form
|
||||
@@ -22,6 +23,40 @@ class Address extends mfBaseModel {
|
||||
|
||||
return $name;
|
||||
|
||||
}
|
||||
|
||||
public function splitPhoneNumber() {
|
||||
if(!$this->phone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->phoneparts) {
|
||||
return $this->phoneparts;
|
||||
}
|
||||
|
||||
$phone = preg_replace('/[^0-9]\+/', '', $this->phone);
|
||||
|
||||
$cc = "";
|
||||
$num = "";
|
||||
if(substr($phone, 0, 1) === '+') {
|
||||
$cc = substr($phone, 1, 2);
|
||||
$num = substr($phone, 3);
|
||||
} elseif(substr($phone, 0, 2) === '00') {
|
||||
$cc = substr($phone, 2, 2);
|
||||
$num = substr($phone, 4);
|
||||
} elseif(substr($phone, 0, 1) === '0') {
|
||||
$cc = 43;
|
||||
$num = substr($phone, 1);
|
||||
} else {
|
||||
$cc = 43;
|
||||
$num = $phone;
|
||||
}
|
||||
|
||||
$this->phoneparts = [$cc,$num];
|
||||
return $this->phoneparts;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getCompanyOrName($returnParent = false) {
|
||||
|
||||
@@ -11,28 +11,24 @@ class Cpeprovisioning extends mfBaseModel {
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "cpeprovisioning") {
|
||||
$this->cpeprovisioning = CpeprovisioningModel::getFirst(["orderproduct_id" => $this->id]);
|
||||
return $this->cpeprovisioning;
|
||||
if($name == "orderproduct") {
|
||||
$this->orderproduct = new OrderProduct($this->orderproduct_id);
|
||||
return $this->orderproduct;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
if($this->id) {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
if($this->id) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
|
||||
@@ -31,19 +31,52 @@ class CpeshippingController extends mfBaseController {
|
||||
|
||||
$pagination['maxItems'] = CpeprovisioningModel::count($provisions_search);
|
||||
$provisions = CpeprovisioningModel::search($provisions_search, $pagination);
|
||||
|
||||
//$o = $provisions[0]->orderproduct->product->attributes;
|
||||
//var_dump($o);exit;
|
||||
$this->layout()->set("cpeprovisionings", $provisions);
|
||||
$this->layout()->set("pagination", $pagination);
|
||||
|
||||
}
|
||||
|
||||
protected function shipAction() {
|
||||
$this->redirect("Cpeshipping");
|
||||
//$this->redirect("Cpeshipping");
|
||||
$r = $this->request;
|
||||
//var_dump($r);exit;
|
||||
|
||||
|
||||
/*if($r->ships) {
|
||||
if(is_array($r->ships) && count($r->ships)) {
|
||||
$ships = $r->ships;
|
||||
}
|
||||
|
||||
$shippings = [];
|
||||
|
||||
foreach($ships as $prov_id) {
|
||||
if(!is_numeric($prov_id) || $prov_id <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}*/
|
||||
$prov = new Cpeprovisioning($prov_id);
|
||||
|
||||
if(!$prov->id) {
|
||||
continue;
|
||||
}
|
||||
if(!$prov->shipping) {
|
||||
// is not supposed to be selectable in UI
|
||||
continue;
|
||||
}
|
||||
$shippings[] = $prov;
|
||||
}
|
||||
|
||||
$tpl = new Layout();
|
||||
$tpl->setTemplate("Cpeshipping/csv/dhl.csv");
|
||||
$tpl->set("shippings", $shippings);
|
||||
$tpl->set("me", $this->me);
|
||||
$body = $tpl->render();
|
||||
|
||||
//$values = $tpl->getReturnedValue();
|
||||
|
||||
header("Content-type: text/csv");
|
||||
echo $body;exit;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,10 @@ class File extends mfBaseModel {
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function createFile($overwrite = false) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
if($this->id) {
|
||||
$id = $this->id;
|
||||
|
||||
Reference in New Issue
Block a user