diff --git a/controllers/shipments_controller.php b/controllers/shipments_controller.php index 345332d3..d22b1ad3 100644 --- a/controllers/shipments_controller.php +++ b/controllers/shipments_controller.php @@ -8,15 +8,59 @@ class ShipmentsController extends AppController { var $paginate = array( 'contain' => false, - 'limit' => 100, + 'limit' => 300, 'order'=>array('Shipment.id' => 'desc'), 'recursive' => 1 ); - function index() { + function index($type = 'all') { + + + + $this->Shipment->recursive = 0; - $this->set('shipments', $this->paginate()); + + switch($type) { + + case 'all': + $conditions = array(); + break; + + case 'import': + + $conditions = array('Shipment.type'=>1); + + + break; + + + case 'direct': + $conditions = array('Shipment.type'=>2); + + break; + + + case 'export': + $conditions = array('Shipment.type'=>3); + + + + break; + + case 'local': + $conditions = array('Shipment.type'=>4); + break; + + + default: + + + + } + $this->set('shipments', $this->paginate($conditions)); + $this->set('type', $type); + $principles = $this->Shipment->Principle->find('list'); $freightForwarders = $this->Shipment->FreightForwarder->find('list'); @@ -41,7 +85,7 @@ class ShipmentsController extends AppController { $shipmentType = $this->typeOptions(false); $shipmentTypeShort = $this->typeOptions(true); $this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort')); - + } function edit($id = null) { diff --git a/models/shipment.php b/models/shipment.php index d8f45b30..55dafc3b 100644 --- a/models/shipment.php +++ b/models/shipment.php @@ -53,7 +53,7 @@ class Shipment extends AppModel { 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' - ), + ), 'ShipmentInvoice' => array( 'className' => 'ShipmentInvoice', 'foreignKey' => 'shipment_id', diff --git a/views/elements/shipment_index_all.ctp b/views/elements/shipment_index_all.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_all.ctp @@ -0,0 +1,121 @@ +
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details + LxWxH (cm) + |
+ Weight (kg) | +sort('freight_forwarder_id');?> | + + +sort('airway_bill');?> | +sort('comments');?> | ++ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + | + ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + | ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + | + ++ + | + +
+
+ if(!empty($principle['short_name'])) {
+ echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ else {
+ echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ ?>
+
+ + + |
+
+
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
+
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
+
+ + + | + +
+
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + + + |
+
+
+
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; + + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg |
+ endif;?>
+ + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | + + ++ + | ++ + | ++ + | +
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details + LxWxH (cm) + |
+ Weight (kg) | +sort('freight_forwarder_id');?> | + + +sort('airway_bill');?> | +sort('comments');?> | ++ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + | + ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + | ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + | + ++ + | + +
+
+ if(!empty($principle['short_name'])) {
+ echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ else {
+ echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ ?>
+
+ + + |
+
+
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
+
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
+
+ + + | + +
+
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + + + |
+
+
+
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; + + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg |
+ endif;?>
+ + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | + + ++ + | ++ + | ++ + | +
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details + LxWxH (cm) + |
+ Weight (kg) | +sort('freight_forwarder_id');?> | + + +sort('airway_bill');?> | +sort('comments');?> | ++ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + | + ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + | ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + | + ++ + | + +
+
+ if(!empty($principle['short_name'])) {
+ echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ else {
+ echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ ?>
+
+ + + |
+
+
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
+
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
+
+ + + | + +
+
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + + + |
+
+
+
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; + + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg |
+ endif;?>
+ + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | + + ++ + | ++ + | ++ + | +
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details + LxWxH (cm) + |
+ Weight (kg) | +sort('freight_forwarder_id');?> | + + +sort('airway_bill');?> | +sort('comments');?> | ++ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + | + ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + | ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + | + ++ + | + +
+
+ if(!empty($principle['short_name'])) {
+ echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ else {
+ echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ ?>
+
+ + + |
+
+
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
+
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
+
+ + + | + +
+
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + + + |
+
+
+
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; + + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg |
+ endif;?>
+ + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | + + ++ + | ++ + | ++ + | +
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details + LxWxH (cm) + |
+ Weight (kg) | +sort('freight_forwarder_id');?> | + + +sort('airway_bill');?> | +sort('comments');?> | ++ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + | + ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + | ++ element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + | + ++ + | + +
+
+ if(!empty($principle['short_name'])) {
+ echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ else {
+ echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
+ }
+ ?>
+
+ + + |
+
+
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
+
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
+
+ + + | + +
+
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + + + |
+
+
+
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; + + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg |
+ endif;?>
+ + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | + + ++ + | ++ + | ++ + | +
| sort('user_id');?> | -sort('date_arrived');?> | -sort('date_dispatched');?> | -sort('type');?> | -Principle(s) | -PO(s) | -Jobs | -sort('# Boxes','box_count');?> | -Box Details - LxWxH (cm) - |
- Weight (kg) | -sort('freight_forwarder_id');?> | -sort('airway_bill');?> | -sort('comments');?> | -- |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - - $initials = $shipment['User']['first_name'][0].$shipment['User']['last_name'][0]; - - echo $html->link($initials, array('controller'=> 'users', 'action'=>'view', $shipment['User']['id'])); ?> - | - -- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); - ?> - | -- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); - ?> - | - -- - | - -
-
- if(!empty($principle['short_name'])) {
- echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
- }
- else {
- echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
- }
- ?>
-
- - - |
-
-
-
- =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
- - - |
-
-
-
- =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
- - - |
-
- - - | - -
-
-
- =$box['length']?>x=$box['width']?>x=$box['height']?> - - $weightString .= $box['weight'].' kg '; - $totalWeight += $box['weight']; ?> - - - |
-
-
-
- $boxCount = $shipment['Shipment']['box_count'];
- if($boxCount > 1) {
- echo $weightString;
- echo ' '; - - }?> - if($boxCount != 0): ?> - =$totalWeight;?> kg |
- endif;?>
- - link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> - | -- - | -- - | -- - | -