Calculate volume
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8c71d76988
commit
38311f526d
|
@ -29,7 +29,6 @@ module.exports = Self => {
|
|||
const models = Self.app.models;
|
||||
|
||||
const entry = await models.Entry.findById(id);
|
||||
console.log(entry);
|
||||
|
||||
const buys = [];
|
||||
for (let buy of args.buys) {
|
||||
|
@ -37,8 +36,10 @@ module.exports = Self => {
|
|||
entryFk: entry.id,
|
||||
itemFk: buy.itemFk,
|
||||
stickers: 1,
|
||||
quantity: 1,
|
||||
packing: buy.packing,
|
||||
grouping: buy.grouping,
|
||||
buyingValue: buy.buyingValue,
|
||||
packageFk: 1
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('importPreview', {
|
||||
description: '',
|
||||
accessType: 'READ',
|
||||
accepts: {
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The entry id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
returns: {
|
||||
type: ['Object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:id/importPreview`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.importPreview = async id => {
|
||||
return buys;
|
||||
};
|
||||
};
|
|
@ -87,15 +87,11 @@
|
|||
<th translate center>Item ID</th>
|
||||
<th translate expand>Description</th>
|
||||
<th translate center>Size</th>
|
||||
<th translate center>Quantity</th>
|
||||
<th translate center>Stickers</th>
|
||||
<th translate center>Packing</th>
|
||||
<th translate center>Grouping</th>
|
||||
<th translate center>Buying value</th>
|
||||
<!-- <th translate center>Package</th>
|
||||
<th translate center>Weight</th>
|
||||
-->
|
||||
|
||||
<th translate center>Package</th>
|
||||
<th translate center>Volume</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-repeat="buy in $ctrl.import.buys">
|
||||
|
@ -118,8 +114,6 @@
|
|||
</td>
|
||||
<td title="{{::buy.description}}" expand>{{::buy.description | dashIfEmpty}}</td>
|
||||
<td center title="{{::buy.size}}">{{::buy.size | dashIfEmpty}}</td>
|
||||
<td center title="{{::buy.quantity}}">{{::line.quantity}}</td>
|
||||
<td center title="{{::buy.stickers | dashIfEmpty}}">{{::line.stickers | dashIfEmpty}}</td>
|
||||
<td center>
|
||||
<vn-chip translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
|
||||
<span translate>{{::buy.packing | dashIfEmpty}}</span>
|
||||
|
@ -131,18 +125,8 @@
|
|||
</vn-chip>
|
||||
</vn-td>
|
||||
<td>{{::buy.buyingValue | currency: 'EUR':2}}</td>
|
||||
<!-- <td center title="{{::line.packageFk | dashIfEmpty}}">{{::line.packageFk | dashIfEmpty}}</td> -->
|
||||
<!-- <td center title="{{::line.weight}}">{{::line.weight}}</td>
|
||||
|
||||
<td center>
|
||||
<vn-chip translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
|
||||
<span translate>{{::line.grouping | dashIfEmpty}}</span>
|
||||
</vn-chip>
|
||||
</vn-td>
|
||||
<td center title="{{::line.buyingValue | currency: 'EUR':2}}">{{::line.buyingValue | currency: 'EUR':2}}</td>
|
||||
<td center title="{{::line.quantity * line.buyingValue | currency: 'EUR':2}}">{{::line.quantity * line.buyingValue | currency: 'EUR':2}}</td>
|
||||
<td center title="{{::line.price2 | currency: 'EUR':2}}">{{::line.price2 | currency: 'EUR':2}}</td>
|
||||
<td center title="{{::line.price3 | currency: 'EUR':2}}">{{::line.price3 | currency: 'EUR':2}}</td> -->
|
||||
<td center title="{{::buy.packageFk | dashIfEmpty}}">{{::buy.packageFk | dashIfEmpty}}</td>
|
||||
<td center title="{{::buy.volume}}">{{::buy.volume | number}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -35,6 +35,7 @@ class Controller extends Section {
|
|||
const boxes = invoice.boxes;
|
||||
const buys = [];
|
||||
for (let box of boxes) {
|
||||
const boxVolume = box.nu_length * box.nu_width * box.nu_height;
|
||||
for (let product of box.products) {
|
||||
const packing = product.nu_stems_bunch * product.nu_bunches;
|
||||
buys.push({
|
||||
|
@ -42,7 +43,8 @@ class Controller extends Section {
|
|||
size: product.nu_length,
|
||||
packing: packing,
|
||||
grouping: product.nu_stems_bunch,
|
||||
buyingValue: parseFloat(product.mny_rate_stem)
|
||||
buyingValue: parseFloat(product.mny_rate_stem),
|
||||
volume: boxVolume
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue