upload orders to the server (#579)
* upload orders to the server * support convert currency * support for currency search, payment types and undoing payment * change iconpull/3759/head
							parent
							
								
									60223ecc14
								
							
						
					
					
						commit
						6f4fc11780
					
				|  | @ -1,33 +1,5 @@ | |||
| <template> | ||||
|   <div> | ||||
|     <el-popover | ||||
|       ref="businessPartnerCreate" | ||||
|       v-model="showsPopovers.isShowCreate" | ||||
|       placement="right" | ||||
|       width="400" | ||||
|       trigger="click" | ||||
|     > | ||||
|       <business-partner-create | ||||
|         v-if="showsPopovers.isShowCreate" | ||||
|         :parent-metadata="parentMetadata" | ||||
|         :shows-popovers="showsPopovers" | ||||
|       /> | ||||
|     </el-popover> | ||||
| 
 | ||||
|     <el-popover | ||||
|       ref="businessPartnersList" | ||||
|       v-model="showsPopovers.isShowList" | ||||
|       placement="right" | ||||
|       width="800" | ||||
|       trigger="click" | ||||
|     > | ||||
|       <!-- v-if="showsPopovers.isShowList" --> | ||||
|       <business-partners-list | ||||
|         :parent-metadata="parentMetadata" | ||||
|         :shows-popovers="showsPopovers" | ||||
|       /> | ||||
|     </el-popover> | ||||
| 
 | ||||
|     <el-form-item> | ||||
|       <template slot="label"> | ||||
|         {{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }} | ||||
|  | @ -73,6 +45,32 @@ | |||
|         </template> | ||||
|       </el-autocomplete> | ||||
|     </el-form-item> | ||||
|     <el-popover | ||||
|       ref="businessPartnerCreate" | ||||
|       v-model="showsPopovers.isShowCreate" | ||||
|       placement="right" | ||||
|       width="400" | ||||
|       trigger="click" | ||||
|     > | ||||
|       <business-partner-create | ||||
|         v-if="showsPopovers.isShowCreate" | ||||
|         :parent-metadata="parentMetadata" | ||||
|         :shows-popovers="showsPopovers" | ||||
|       /> | ||||
|     </el-popover> | ||||
| 
 | ||||
|     <el-popover | ||||
|       ref="businessPartnersList" | ||||
|       v-model="showsPopovers.isShowList" | ||||
|       placement="right" | ||||
|       width="800" | ||||
|       trigger="click" | ||||
|     > | ||||
|       <business-partners-list | ||||
|         :parent-metadata="parentMetadata" | ||||
|         :shows-popovers="showsPopovers" | ||||
|       /> | ||||
|     </el-popover> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,6 +15,20 @@ export default [ | |||
|       isMandatory: true | ||||
|     } | ||||
|   }, | ||||
|   // Currency
 | ||||
|   { | ||||
|     tableName: 'C_Order', | ||||
|     columnName: 'C_Currency_ID', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|       handleActionKeyPerformed: true, | ||||
|       handleActionPerformed: true, | ||||
|       validationCode: 'C_Currency.C_Currency_ID = 100', | ||||
|       isActiveLogics: true, | ||||
|       isMandatory: true | ||||
|     } | ||||
|   }, | ||||
|   // TenderType
 | ||||
|   { | ||||
|     tableName, | ||||
|  | @ -64,20 +78,6 @@ export default [ | |||
|       isMandatory: true | ||||
|     } | ||||
|   }, | ||||
|   // Currency
 | ||||
|   { | ||||
|     tableName: 'C_Order', | ||||
|     columnName: 'C_Currency_ID', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|       handleActionKeyPerformed: true, | ||||
|       handleActionPerformed: true, | ||||
|       validationCode: 'C_Currency.C_Currency_ID = 100', | ||||
|       isActiveLogics: true, | ||||
|       isMandatory: true | ||||
|     } | ||||
|   }, | ||||
|   // ReferenceNo
 | ||||
|   { | ||||
|     tableName: 'HR_Attribute', | ||||
|  |  | |||
|  | @ -63,17 +63,8 @@ | |||
|             </div> | ||||
|           </el-card> | ||||
|           <samp style="float: right;padding-right: 10px;"> | ||||
|             <el-checkbox v-show="fullCopper" v-model="checked"> | ||||
|               <el-link | ||||
|                 type="danger" | ||||
|                 class="stylefullPayment" | ||||
|               > | ||||
|                 <b> | ||||
|                   {{ $t('form.pos.collect.fullPayment') }} | ||||
|                 </b> | ||||
|               </el-link> | ||||
|             </el-checkbox> | ||||
|             <el-button type="danger" icon="el-icon-close" @click="exit" /> | ||||
|             <el-button type="info" icon="el-icon-minus" @click="undoPatment" /> | ||||
|             <el-button type="primary" :disabled="validPay || addPay" icon="el-icon-plus" @click="addCollectToList(paymentBox)" /> | ||||
|             <el-button type="success" :disabled="validateCompleteCollection" icon="el-icon-shopping-cart-full" /> | ||||
|           </samp> | ||||
|  | @ -228,7 +219,9 @@ export default { | |||
|       allPayCurrency: 0, | ||||
|       labelTenderType: '', | ||||
|       defaultLabel: '', | ||||
|       fieldsList: fieldsListCollection | ||||
|       fieldsList: fieldsListCollection, | ||||
|       sendToServer: false, | ||||
|       amontSend: 0 | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|  | @ -265,7 +258,12 @@ export default { | |||
|       return false | ||||
|     }, | ||||
|     listPayments() { | ||||
|       return this.$store.getters.getListPayments | ||||
|       const listLocal = this.$store.getters.getPaymentBox | ||||
|       const listServer = this.$store.getters.getListPayments | ||||
|       if (!this.sendToServer) { | ||||
|         return listServer.reverse() | ||||
|       } | ||||
|       return listLocal | ||||
|     }, | ||||
|     paymentBox() { | ||||
|       const payment = this.isPaymentBox.filter(pay => { | ||||
|  | @ -451,7 +449,13 @@ export default { | |||
|       return true | ||||
|     }, | ||||
|     fieldpending() { | ||||
|       return this.pending * this.multiplyRateCollection | ||||
|       return this.pending | ||||
|     }, | ||||
|     displayCurrency() { | ||||
|       return this.$store.getters.getListCurrency | ||||
|     }, | ||||
|     convert() { | ||||
|       return this.$store.getters.getConvertionPayment | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
|  | @ -522,7 +526,7 @@ export default { | |||
|   }, | ||||
|   mounted() { | ||||
|     setTimeout(() => { | ||||
|       this.tenderTypeDisplaye() | ||||
|       this.convertCurrency() | ||||
|     }, 1000) | ||||
|   }, | ||||
|   methods: { | ||||
|  | @ -547,7 +551,7 @@ export default { | |||
|         containerUuid, | ||||
|         columnName: 'C_Bank_ID_UUID' | ||||
|       }) | ||||
|       const amount = this.$store.getters.getValueOfField({ | ||||
|       this.amontSend = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'PayAmt' | ||||
|       }) | ||||
|  | @ -567,19 +571,46 @@ export default { | |||
|         containerUuid, | ||||
|         columnName: 'C_Currency_ID_UUID' | ||||
|       }) | ||||
| 
 | ||||
|       this.$store.dispatch('createPayments', { | ||||
|         posUuid, | ||||
|         orderUuid, | ||||
|         bankUuid, | ||||
|         referenceNo, | ||||
|         amount, | ||||
|         paymentDate, | ||||
|         tenderTypeCode, | ||||
|         currencyUuid | ||||
|       const currencyId = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'C_Currency_ID' | ||||
|       }) | ||||
|       const currencyToPay = this.isEmptyValue(currencyUuid) ? currencyId : currencyUuid | ||||
|       if (this.currencyDisplay(currencyToPay).currencyUuid !== this.currencyPoint.uuid) { | ||||
|         this.amontSend = this.convert.divideRate * this.amontSend | ||||
|       } | ||||
|       if (this.sendToServer) { | ||||
|         this.$store.dispatch('setPaymentBox', { | ||||
|           posUuid, | ||||
|           orderUuid, | ||||
|           bankUuid, | ||||
|           referenceNo, | ||||
|           amount: this.amontSend, | ||||
|           paymentDate, | ||||
|           tenderTypeCode, | ||||
|           currencyUuid | ||||
|         }) | ||||
|       } else { | ||||
|         this.$store.dispatch('createPayments', { | ||||
|           posUuid, | ||||
|           orderUuid, | ||||
|           bankUuid, | ||||
|           referenceNo, | ||||
|           amount: this.amontSend, | ||||
|           paymentDate, | ||||
|           tenderTypeCode, | ||||
|           currencyUuid: this.currencyDisplay(currencyToPay).currencyUuid | ||||
|         }) | ||||
|       } | ||||
|       this.amontSend = 0 | ||||
|       this.addCollect() | ||||
|     }, | ||||
|     updateServer(listPaymentsLocal) { | ||||
|       // const listLocal = this.$store.getters.getPaymentBox | ||||
|       const posUuid = this.$store.getters.getCurrentPOS.uuid | ||||
|       const orderUuid = this.$route.query.action | ||||
|       this.$store.dispatch('uploadOrdersToServer', { listPaymentsLocal, posUuid, orderUuid }) | ||||
|     }, | ||||
|     addCollect() { | ||||
|       this.fieldsList.forEach(element => { | ||||
|         if (element.columnName !== 'PayAmt') { | ||||
|  | @ -693,17 +724,33 @@ export default { | |||
|         value: this.$t('form.pos.collect.TenderType.cash') | ||||
|       }) | ||||
|     }, | ||||
|     tenderTypeDisplaye() { | ||||
|       if (!this.isEmptyValue(this.fieldsList)) { | ||||
|         const tenderType = this.fieldsList[1].reference | ||||
|         this.$store.dispatch('getLookupListFromServer', { | ||||
|           tableName: tenderType.tableName, | ||||
|           query: tenderType.query | ||||
|         }) | ||||
|           .then(response => { | ||||
|             this.$store.dispatch('tenderTypeDisplaye', response) | ||||
|           }) | ||||
|     currencyDisplay(currency) { | ||||
|       const display = this.displayCurrency.find(item => { | ||||
|         if (item.currencyUuid === currency || (item.currencyId === currency)) { | ||||
|           return item | ||||
|         } | ||||
|       }) | ||||
|       if (display) { | ||||
|         return display | ||||
|       } | ||||
|       return currency | ||||
|     }, | ||||
|     convertCurrency() { | ||||
|       const convertCurrency = this.currencyDisplay(100) | ||||
|       this.$store.dispatch('convertionPayment', { | ||||
|         conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid, | ||||
|         currencyFromUuid: this.currencyPoint.uuid, | ||||
|         currencyToUuid: convertCurrency.currencyUuid | ||||
|       }) | ||||
|     }, | ||||
|     undoPatment() { | ||||
|       const list = this.listPayments[this.listPayments.length - 1] | ||||
|       const orderUuid = list.orderUuid | ||||
|       const paymentUuid = list.uuid | ||||
|       this.$store.dispatch('deletetPayments', { | ||||
|         orderUuid, | ||||
|         paymentUuid | ||||
|       }) | ||||
|     }, | ||||
|     subscribeChanges() { | ||||
|       return this.$store.subscribe((mutation, state) => { | ||||
|  |  | |||
|  | @ -18,7 +18,14 @@ | |||
|                   /> | ||||
|                   <div style="padding-right: 10px; padding-top: 10%;"> | ||||
|                     <div class="top clearfix"> | ||||
|                       <span>{{ tenderTypeDisplay(value.tenderTypeCode) }}</span> | ||||
|                       <span> | ||||
|                         {{ | ||||
|                           tenderTypeFind({ | ||||
|                             currentPayment: value.tenderTypeCode, | ||||
|                             listTypePayment: typesPayment | ||||
|                           }) | ||||
|                         }} | ||||
|                       </span> | ||||
|                     </div> | ||||
|                     <div class="bottom clearfix" style="margin-top: 0px !important!"> | ||||
|                       <el-button | ||||
|  | @ -37,17 +44,41 @@ | |||
|                       > | ||||
|                         {{ formatDate(value.paymentDate) }} | ||||
|                       </el-button> | ||||
| 
 | ||||
|                       <div slot="header" class="clearfix"> | ||||
|                         <p class="total" :style="value.currencyUuid === currency.id ? 'padding-top: 5%;' : ''"> | ||||
|                           <b style="float: right; padding-bottom: 10px"> | ||||
|                       <div | ||||
|                         v-if="currencyFind({ | ||||
|                           currencyCurrent: value.currencyUuid, | ||||
|                           listCurrency: listCurrency, | ||||
|                           defaultCurrency: currency | ||||
|                         }).currencyDisplay !== currency.iSOCode" | ||||
|                         slot="header" | ||||
|                         class="clearfix" | ||||
|                         style="padding-bottom: 20px;" | ||||
|                       > | ||||
|                         <p class="total"> | ||||
|                           <b style="float: right;"> | ||||
|                             {{ formatPrice(value.amount, currency.iSOCode) }} | ||||
|                           </b> | ||||
|                         </p> | ||||
|                         <br> | ||||
|                         <p v-if="value.currencyUuid !== currency.id" class="total"> | ||||
|                           <b style="float: right; padding-bottom: 10px"> | ||||
|                             {{ formatPrice(value.quantityCahs) }} | ||||
|                         <p class="total"> | ||||
|                           <b style="float: right;"> | ||||
|                             {{ | ||||
|                               formatPrice( | ||||
|                                 (amountConvertion(value)), | ||||
|                                 currencyFind({ | ||||
|                                   currencyCurrent: value.currencyUuid, | ||||
|                                   listCurrency: listCurrency, | ||||
|                                   defaultCurrency: currency | ||||
|                                 }).currencyDisplay | ||||
|                               ) | ||||
|                             }} | ||||
|                           </b> | ||||
|                         </p> | ||||
|                       </div> | ||||
|                       <div v-else slot="header" class="clearfix"> | ||||
|                         <p class="total"> | ||||
|                           <b style="float: right;padding-top: 18px;padding-bottom: 20px;"> | ||||
|                             {{ formatPrice(value.amount, currency.iSOCode) }} | ||||
|                           </b> | ||||
|                         </p> | ||||
|                       </div> | ||||
|  | @ -81,9 +112,20 @@ export default { | |||
|       default: undefined | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       conevertion: 0 | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     label() { | ||||
|       return this.$store.getters.getTenderTypeDisplaye | ||||
|     typesPayment() { | ||||
|       return this.$store.getters.getListsPaymentTypes | ||||
|     }, | ||||
|     listCurrency() { | ||||
|       return this.$store.getters.getListCurrency | ||||
|     }, | ||||
|     conevertionAmount() { | ||||
|       return this.$store.getters.getConvertionPayment | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|  | @ -139,16 +181,8 @@ export default { | |||
|         paymentUuid | ||||
|       }) | ||||
|     }, | ||||
|     tenderTypeDisplay(payments) { | ||||
|       const display = this.label.find(item => { | ||||
|         if (item.tenderTypeCode === payments) { | ||||
|           return item.tenderTypeDisplay | ||||
|         } | ||||
|       }) | ||||
|       if (display) { | ||||
|         return display.tenderTypeDisplay | ||||
|       } | ||||
|       return payments | ||||
|     amountConvertion(payment) { | ||||
|       return payment.amount * this.conevertionAmount.multiplyRate | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -3,10 +3,12 @@ export default [ | |||
|   { | ||||
|     elementColumnName: 'ProductValue', | ||||
|     columnName: 'ProductValue', | ||||
|     tabindex: '1', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|       sequence: 10, | ||||
|       handleFocusGained: true, | ||||
|       handleActionPerformed: true, | ||||
|       handleActionKeyPerformed: true | ||||
|     } | ||||
|  | @ -14,6 +16,7 @@ export default [ | |||
|   { | ||||
|     elementColumnName: 'QtyEntered', | ||||
|     columnName: 'QtyEntered', | ||||
|     tabindex: '2', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|  | @ -26,6 +29,7 @@ export default [ | |||
|   { | ||||
|     elementColumnName: 'PriceEntered', | ||||
|     columnName: 'PriceEntered', | ||||
|     tabindex: '3', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|  | @ -39,6 +43,7 @@ export default [ | |||
|   { | ||||
|     elementColumnName: 'Discount', | ||||
|     columnName: 'Discount', | ||||
|     tabindex: '4', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|  | @ -48,5 +53,34 @@ export default [ | |||
|       handleContentSelection: true, | ||||
|       handleActionKeyPerformed: true | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     tableName: 'C_Order', | ||||
|     columnName: 'C_Currency_ID', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 24, | ||||
|       handleActionKeyPerformed: true, | ||||
|       handleActionPerformed: true, | ||||
|       validationCode: 'C_Currency.C_Currency_ID = 100', | ||||
|       isActiveLogics: false, | ||||
|       isMandatory: true | ||||
|     } | ||||
|   }, | ||||
|   // TenderType
 | ||||
|   { | ||||
|     tableName: 'C_Payment', | ||||
|     elementColumnName: 'TenderType', | ||||
|     columnName: 'TenderType', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       defaultValue: 'X', | ||||
|       handleActionKeyPerformed: true, | ||||
|       handleContentSelection: true, | ||||
|       handleActionPerformed: true, | ||||
|       size: 24, | ||||
|       isActiveLogics: false, | ||||
|       isMandatory: true | ||||
|     } | ||||
|   } | ||||
| ] | ||||
|  |  | |||
|  | @ -84,7 +84,7 @@ | |||
|                       <i class="el-icon-arrow-down el-icon--right" /> | ||||
|                     </span> | ||||
|                     <el-dropdown-menu slot="dropdown" style="padding-bottom: 0px;"> | ||||
|                       <el-dropdown-item icon="el-icon-info" :command="scope.row"> | ||||
|                       <el-dropdown-item :command="scope.row"> | ||||
|                         <el-popover | ||||
|                           placement="right" | ||||
|                           trigger="click" | ||||
|  | @ -126,12 +126,12 @@ | |||
|                               </el-col> | ||||
|                             </el-row> | ||||
|                           </el-form> | ||||
|                           <el-button slot="reference" type="text"> | ||||
|                             {{ $t('form.productInfo.productInformation') }} | ||||
|                           <el-button slot="reference" type="text" style="display: flex;width: 110%;padding-bottom: 5%;padding-top: 5%;"> | ||||
|                             <i class="el-icon-info" /> {{ $t('form.productInfo.productInformation') }} | ||||
|                           </el-button> | ||||
|                         </el-popover> | ||||
|                       </el-dropdown-item> | ||||
|                       <el-dropdown-item icon="el-icon-edit" :command="$t('form.pos.tableProduct.editQuantities')"> | ||||
|                       <el-dropdown-item :command="$t('form.pos.tableProduct.editQuantities')"> | ||||
|                         <el-popover | ||||
|                           placement="right" | ||||
|                           trigger="click" | ||||
|  | @ -179,7 +179,7 @@ | |||
|                             </el-col> | ||||
|                           </el-row> | ||||
|                           <el-button slot="reference" type="text"> | ||||
|                             {{ $t('form.pos.tableProduct.editQuantities') }} | ||||
|                             <i class="el-icon-edit" /> {{ $t('form.pos.tableProduct.editQuantities') }} | ||||
|                           </el-button> | ||||
|                         </el-popover> | ||||
|                       </el-dropdown-item> | ||||
|  | @ -444,6 +444,12 @@ export default { | |||
|       } | ||||
|     } | ||||
|   }, | ||||
|   mounted() { | ||||
|     setTimeout(() => { | ||||
|       this.tenderTypeDisplaye() | ||||
|       this.currencyDisplaye() | ||||
|     }, 1500) | ||||
|   }, | ||||
|   methods: { | ||||
|     changePos(posElement) { | ||||
|       this.$store.dispatch('setCurrentPOS', posElement) | ||||
|  | @ -503,6 +509,30 @@ export default { | |||
|       if (!this.seeConversion) { | ||||
|         this.seeConversion = true | ||||
|       } | ||||
|     }, | ||||
|     tenderTypeDisplaye() { | ||||
|       if (!this.isEmptyValue(this.fieldsList)) { | ||||
|         const tenderType = this.fieldsList[5].reference | ||||
|         this.$store.dispatch('getLookupListFromServer', { | ||||
|           tableName: tenderType.tableName, | ||||
|           query: tenderType.query | ||||
|         }) | ||||
|           .then(response => { | ||||
|             this.$store.dispatch('tenderTypeDisplaye', response) | ||||
|           }) | ||||
|       } | ||||
|     }, | ||||
|     currencyDisplaye() { | ||||
|       if (!this.isEmptyValue(this.fieldsList)) { | ||||
|         const currency = this.fieldsList[4].reference | ||||
|         this.$store.dispatch('getLookupListFromServer', { | ||||
|           tableName: currency.tableName, | ||||
|           query: currency.query | ||||
|         }) | ||||
|           .then(response => { | ||||
|             this.$store.dispatch('currencyDisplaye', response) | ||||
|           }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ const tableName = 'C_Order' | |||
| export default [ | ||||
|   { | ||||
|     tableName, | ||||
|     elementColumnName: 'DocumentNo', | ||||
|     columnName: 'DocumentNo', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|  | @ -12,6 +13,7 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     elementColumnName: 'C_BPartner_ID', | ||||
|     columnName: 'C_BPartner_ID', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|  | @ -22,6 +24,7 @@ export default [ | |||
|   { | ||||
|     tableName, | ||||
|     columnName: 'GrandTotal', | ||||
|     elementColumnName: 'GrandTotal', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 8, | ||||
|  | @ -48,7 +51,7 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     columnName: 'Processed', | ||||
|     elementColumnName: 'Processed', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 8, | ||||
|  | @ -66,7 +69,8 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     columnName: 'IsInvoiced', | ||||
|     elementColumnName: 'IsInvoiced', | ||||
|     columnName: 'IsInvoiced ', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       size: 8, | ||||
|  | @ -75,6 +79,7 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     elementColumnName: 'DateOrdered', | ||||
|     columnName: 'DateOrdered', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|  | @ -85,7 +90,8 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     columnName: 'DateOrdered', | ||||
|     elementColumnName: 'DateOrdered', | ||||
|     columnName: 'DateOrderedTo', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|       columnName: 'DateOrderedTo', | ||||
|  | @ -95,6 +101,7 @@ export default [ | |||
|   }, | ||||
|   { | ||||
|     tableName, | ||||
|     elementColumnName: 'SalesRep_ID', | ||||
|     columnName: 'SalesRep_ID', | ||||
|     isFromDictionary: true, | ||||
|     overwriteDefinition: { | ||||
|  |  | |||
|  | @ -17,7 +17,14 @@ const collection = { | |||
|     multiplyRateCollection: 1, | ||||
|     divideRateCollection: 1, | ||||
|     listPayments: [], | ||||
|     tenderTypeDisplaye: [] | ||||
|     tenderTypeDisplaye: [ | ||||
|       { | ||||
|         tenderTypeCode: 0, | ||||
|         tenderTypeDisplay: '' | ||||
|       } | ||||
|     ], | ||||
|     currency: [], | ||||
|     convertion: {} | ||||
|   }, | ||||
|   mutations: { | ||||
|     addPaymentBox(state, paymentBox) { | ||||
|  | @ -40,6 +47,12 @@ const collection = { | |||
|     }, | ||||
|     setTenderTypeDisplaye(state, tenderTypeDisplaye) { | ||||
|       state.tenderTypeDisplaye = tenderTypeDisplaye | ||||
|     }, | ||||
|     setCurrencyDisplaye(state, currency) { | ||||
|       state.currency = currency | ||||
|     }, | ||||
|     setConvertionPayment(state, convertion) { | ||||
|       state.convertion = convertion | ||||
|     } | ||||
|   }, | ||||
|   actions: { | ||||
|  | @ -86,6 +99,38 @@ const collection = { | |||
|         state.paymentBox = addPayment | ||||
|       } | ||||
|     }, | ||||
|     // upload orders to theServer
 | ||||
|     uploadOrdersToServer({ dispatch }, { | ||||
|       listPaymentsLocal, | ||||
|       posUuid, | ||||
|       orderUuid | ||||
|     }) { | ||||
|       listPaymentsLocal.forEach(payment => { | ||||
|         requestCreatePayment({ | ||||
|           posUuid, | ||||
|           orderUuid, | ||||
|           bankUuid: payment.bankUuid, | ||||
|           referenceNo: payment.referenceNo, | ||||
|           description: payment.description, | ||||
|           amount: payment.amount, | ||||
|           paymentDate: payment.paymentDate, | ||||
|           tenderTypeCode: payment.tenderTypeCode, | ||||
|           currencyUuid: payment.currencyUuid | ||||
|         }) | ||||
|           .then(response => { | ||||
|             const orderUuid = response.order_uuid | ||||
|             dispatch('listPayments', { orderUuid }) | ||||
|           }) | ||||
|           .catch(error => { | ||||
|             console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) | ||||
|             showMessage({ | ||||
|               type: 'error', | ||||
|               message: error.message, | ||||
|               showClose: true | ||||
|             }) | ||||
|           }) | ||||
|       }) | ||||
|     }, | ||||
|     deleteCollectBox({ state }, key) { | ||||
|       const payment = state.paymentBox | ||||
|       payment.splice(key, 1) | ||||
|  | @ -224,12 +269,10 @@ const collection = { | |||
|       orderUuid, | ||||
|       paymentUuid | ||||
|     }) { | ||||
|       console.log(paymentUuid, orderUuid) | ||||
|       requestDeletePayment({ | ||||
|         paymentUuid | ||||
|       }) | ||||
|         .then(response => { | ||||
|           console.log(response.listPayments) | ||||
|           dispatch('listPayments', { orderUuid }) | ||||
|         }) | ||||
|         .catch(error => { | ||||
|  | @ -241,13 +284,12 @@ const collection = { | |||
|           }) | ||||
|         }) | ||||
|     }, | ||||
|     listPayments({ commit }, { posUuid, orderUuid }) { | ||||
|     listPayments({ commit, rootGetters }, { posUuid, orderUuid }) { | ||||
|       requestListPayments({ | ||||
|         posUuid, | ||||
|         orderUuid | ||||
|       }) | ||||
|         .then(response => { | ||||
|           console.log(response.listPayments) | ||||
|           commit('setListPayments', response.listPayments) | ||||
|         }) | ||||
|         .catch(error => { | ||||
|  | @ -267,6 +309,38 @@ const collection = { | |||
|         } | ||||
|       }) | ||||
|       commit('setTenderTypeDisplaye', displayTenderType) | ||||
|     }, | ||||
|     currencyDisplaye({ commit }, currency) { | ||||
|       const displaycurrency = currency.map(item => { | ||||
|         return { | ||||
|           currencyUuid: item.uuid, | ||||
|           currencyId: item.id, | ||||
|           currencyDisplay: item.label | ||||
|         } | ||||
|       }) | ||||
|       commit('setCurrencyDisplaye', displaycurrency) | ||||
|     }, | ||||
|     convertionPayment({ commit }, { | ||||
|       conversionTypeUuid, | ||||
|       currencyFromUuid, | ||||
|       currencyToUuid | ||||
|     }) { | ||||
|       requestGetConversionRate({ | ||||
|         conversionTypeUuid, | ||||
|         currencyFromUuid, | ||||
|         currencyToUuid | ||||
|       }) | ||||
|         .then(response => { | ||||
|           commit('setConvertionPayment', response) | ||||
|         }) | ||||
|         .catch(error => { | ||||
|           console.warn(`ConvertionPayment: ${error.message}. Code: ${error.code}.`) | ||||
|           showMessage({ | ||||
|             type: 'error', | ||||
|             message: error.message, | ||||
|             showClose: true | ||||
|           }) | ||||
|         }) | ||||
|     } | ||||
|   }, | ||||
|   getters: { | ||||
|  | @ -286,11 +360,16 @@ const collection = { | |||
|       return state.divideRateCollection | ||||
|     }, | ||||
|     getListPayments: (state) => { | ||||
|       console.log(state.listPayments) | ||||
|       return state.listPayments | ||||
|     }, | ||||
|     getTenderTypeDisplaye: (state) => { | ||||
|     getListsPaymentTypes: (state) => { | ||||
|       return state.tenderTypeDisplaye | ||||
|     }, | ||||
|     getListCurrency: (state) => { | ||||
|       return state.currency | ||||
|     }, | ||||
|     getConvertionPayment: (state) => { | ||||
|       return state.convertion | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -6,5 +6,7 @@ export { | |||
|   isEmptyValue, | ||||
|   calculationValue, | ||||
|   clearVariables, | ||||
|   currencyFind, | ||||
|   tenderTypeFind, | ||||
|   typeValue | ||||
| } from '@/utils/ADempiere/valueUtils.js' | ||||
|  |  | |||
|  | @ -251,6 +251,7 @@ export const recursiveTreeSearch = ({ | |||
| 
 | ||||
| /** | ||||
|  * Parsed value to component type | ||||
|  * @author Elsio Sanchez <elsiosanches@gmail.com> | ||||
|  * @param {mixed} value, value to parsed | ||||
|  * @param {string} componentPath | ||||
|  * @param {number} displayType, reference in ADempiere | ||||
|  | @ -358,6 +359,7 @@ export function parsedValueComponent({ | |||
| 
 | ||||
| /** | ||||
|  * add a tab depending on the status of the document | ||||
|  * @author Elsio Sanchez <elsiosanches@gmail.com> | ||||
|  * @param {string} tag, document status key | ||||
|  */ | ||||
| export function tagStatus(tag) { | ||||
|  | @ -405,7 +407,8 @@ export function tagStatus(tag) { | |||
| 
 | ||||
| /** | ||||
|  * add a tab depending on the status of the document | ||||
|  * @param {string} tag, document status key | ||||
|  * @author Elsio Sanchez <elsiosanches@gmail.com> | ||||
|  * @param {string} iconElment, icon the Elment | ||||
|  */ | ||||
| export function iconStatus(iconElment) { | ||||
|   let icon | ||||
|  | @ -479,7 +482,51 @@ export function calculationValue(value, event) { | |||
|     } | ||||
|   } | ||||
| } | ||||
| /** | ||||
|  * Search in the currency lists for the current currency | ||||
|  * @author Elsio Sanchez <elsiosanches@gmail.com> | ||||
|  * @param {string} currencyCurrent current currency to search | ||||
|  * @param {array} listCurrency Currency Listing | ||||
|  * @param {object} currencyCurrent Default Currency | ||||
|  */ | ||||
| export function currencyFind({ | ||||
|   currencyCurrent, | ||||
|   listCurrency, | ||||
|   defaultCurrency | ||||
| }) { | ||||
|   if (!isEmptyValue(listCurrency)) { | ||||
|     const currency = listCurrency.find(item => { | ||||
|       if (item.currencyUuid === currencyCurrent) { | ||||
|         return item | ||||
|       } | ||||
|     }) | ||||
|     if (currency) { | ||||
|       return currency | ||||
|     } | ||||
|   } | ||||
|   return defaultCurrency.iSOCode | ||||
| } | ||||
| /** | ||||
|  * Search the Payment List for the Current Payment | ||||
|  * @author Elsio Sanchez <elsiosanches@gmail.com> | ||||
|  * @param {string} currentPayment Current Payment | ||||
|  * @param {array} listTypePayment Payment Type Listings | ||||
|  */ | ||||
| 
 | ||||
| export function tenderTypeFind({ | ||||
|   currentPayment, | ||||
|   listTypePayment | ||||
| }) { | ||||
|   const payment = listTypePayment.find(item => { | ||||
|     if (item.tenderTypeCode === currentPayment) { | ||||
|       return item.tenderTypeDisplay | ||||
|     } | ||||
|   }) | ||||
|   if (payment) { | ||||
|     return payment.tenderTypeDisplay | ||||
|   } | ||||
|   return currentPayment | ||||
| } | ||||
| export function clearVariables() { | ||||
|   partialValue = '' | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Elsio Sanchez
						Elsio Sanchez