| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- Ext.define('saas.model.sale.Saledetail', {
- extend: 'saas.model.Base',
- fields: [
- { name: 'id', type: 'int' }, // id
- { name: 'sd_prodid', type: 'int' }, // 物料id
- { name: 'sd_prodcode', type: 'string' }, // 物料编号
- { name: 'pr_brand', type: 'string' }, // 品牌
- { name: 'pr_detail', type: 'string' }, // 名称
- { name: 'pr_orispeccode', type: 'string' }, // 型号
- { name: 'pr_spec', type: 'string' }, // 规格
- { name: 'sd_qty', type: 'float' }, // 数量
- { name: 'pr_unit', type: 'float' }, // 单位
- { name: 'sd_netprice', type: 'float', // 单价
- },
- { name: 'sd_price', type: 'float', // 含税单价
- convert: function(v, rec) {
- var t = rec.get('sd_netprice') * (1 + rec.get('sd_taxrate') / 100);
- return Number(saas.util.BaseUtil.numberFormat(t, 4, false));
- },
- depends: ['sd_netprice', 'sd_taxrate']
- },
- { name: 'sd_nettotal', type: 'float', // 金额
- convert: function(v, rec) {
- var t = rec.get('sd_netprice') * rec.get('sd_qty');
- return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
- },
- depends: ['sd_netprice', 'sd_qty']
- },
- { name: 'sd_taxrate', type: 'float' }, // 税率
- { name: 'sd_taxamount', type: 'float', // 税额
- convert: function(v, rec) {
- var t = rec.get('sd_total') - rec.get('sd_nettotal');
- return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
- },
- depends: ['sd_total', 'sd_nettotal']
- },
- { name: 'sd_total', type: 'float',// 价税合计
- convert: function(v, rec) {
- var t = rec.get('sd_price') * rec.get('sd_qty');
- return Number(saas.util.BaseUtil.numberFormat(t, 2, false));
- },
- depends: ['sd_price', 'sd_qty']
- },
- { name: 'sd_delivery', type: 'date' }, // 交货日期
- { name: 'sd_remark', type: 'string' }, // 备注
- ],
- //一对一映射
- associations: [{ type: 'hasOne', model: 'saas.model.document.Product', associationKey: 'productDTO'}]
- });
|