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 models = Self.app.models;
|
||||||
|
|
||||||
const entry = await models.Entry.findById(id);
|
const entry = await models.Entry.findById(id);
|
||||||
console.log(entry);
|
|
||||||
|
|
||||||
const buys = [];
|
const buys = [];
|
||||||
for (let buy of args.buys) {
|
for (let buy of args.buys) {
|
||||||
|
@ -37,8 +36,10 @@ module.exports = Self => {
|
||||||
entryFk: entry.id,
|
entryFk: entry.id,
|
||||||
itemFk: buy.itemFk,
|
itemFk: buy.itemFk,
|
||||||
stickers: 1,
|
stickers: 1,
|
||||||
|
quantity: 1,
|
||||||
packing: buy.packing,
|
packing: buy.packing,
|
||||||
grouping: buy.grouping,
|
grouping: buy.grouping,
|
||||||
|
buyingValue: buy.buyingValue,
|
||||||
packageFk: 1
|
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 center>Item ID</th>
|
||||||
<th translate expand>Description</th>
|
<th translate expand>Description</th>
|
||||||
<th translate center>Size</th>
|
<th translate center>Size</th>
|
||||||
<th translate center>Quantity</th>
|
|
||||||
<th translate center>Stickers</th>
|
|
||||||
<th translate center>Packing</th>
|
<th translate center>Packing</th>
|
||||||
<th translate center>Grouping</th>
|
<th translate center>Grouping</th>
|
||||||
<th translate center>Buying value</th>
|
<th translate center>Buying value</th>
|
||||||
<!-- <th translate center>Package</th>
|
<th translate center>Package</th>
|
||||||
<th translate center>Weight</th>
|
<th translate center>Volume</th>
|
||||||
-->
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody ng-repeat="buy in $ctrl.import.buys">
|
<tbody ng-repeat="buy in $ctrl.import.buys">
|
||||||
|
@ -118,8 +114,6 @@
|
||||||
</td>
|
</td>
|
||||||
<td title="{{::buy.description}}" expand>{{::buy.description | dashIfEmpty}}</td>
|
<td title="{{::buy.description}}" expand>{{::buy.description | dashIfEmpty}}</td>
|
||||||
<td center title="{{::buy.size}}">{{::buy.size | 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>
|
<td center>
|
||||||
<vn-chip translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
|
<vn-chip translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
|
||||||
<span translate>{{::buy.packing | dashIfEmpty}}</span>
|
<span translate>{{::buy.packing | dashIfEmpty}}</span>
|
||||||
|
@ -131,18 +125,8 @@
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<td>{{::buy.buyingValue | currency: 'EUR':2}}</td>
|
<td>{{::buy.buyingValue | currency: 'EUR':2}}</td>
|
||||||
<!-- <td center title="{{::line.packageFk | dashIfEmpty}}">{{::line.packageFk | dashIfEmpty}}</td> -->
|
<td center title="{{::buy.packageFk | dashIfEmpty}}">{{::buy.packageFk | dashIfEmpty}}</td>
|
||||||
<!-- <td center title="{{::line.weight}}">{{::line.weight}}</td>
|
<td center title="{{::buy.volume}}">{{::buy.volume | number}}</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> -->
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Controller extends Section {
|
||||||
const boxes = invoice.boxes;
|
const boxes = invoice.boxes;
|
||||||
const buys = [];
|
const buys = [];
|
||||||
for (let box of boxes) {
|
for (let box of boxes) {
|
||||||
|
const boxVolume = box.nu_length * box.nu_width * box.nu_height;
|
||||||
for (let product of box.products) {
|
for (let product of box.products) {
|
||||||
const packing = product.nu_stems_bunch * product.nu_bunches;
|
const packing = product.nu_stems_bunch * product.nu_bunches;
|
||||||
buys.push({
|
buys.push({
|
||||||
|
@ -42,7 +43,8 @@ class Controller extends Section {
|
||||||
size: product.nu_length,
|
size: product.nu_length,
|
||||||
packing: packing,
|
packing: packing,
|
||||||
grouping: product.nu_stems_bunch,
|
grouping: product.nu_stems_bunch,
|
||||||
buyingValue: parseFloat(product.mny_rate_stem)
|
buyingValue: parseFloat(product.mny_rate_stem),
|
||||||
|
volume: boxVolume
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue