Browse Source

[ADD] Validaciones de cliente , factura , Cuotas

adrielso 7 năm trước cách đây
mục cha
commit
cdf9606dae

+ 0 - 1
models/__init__.py

@@ -1 +0,0 @@
-# -*- coding: utf-8 -*-

+ 0 - 109
models/account_voucher.py

@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-from openerp import api, fields, models
-from openerp.exceptions import except_orm
-
-
-class AccountVoucher(models.Model):
-    _inherit = 'account.voucher'
-
-    @api.model
-    def create_from_payments(self, values):
-        # step 1  Verificar Datos
-        #period Actual
-        period = self.env['account.period'].search([('date_start', '<=', fields.Date.context_today(self) ),('date_stop', '>=', fields.Date.context_today(self))])
-        # Diario & Moneda
-        journal = self.env['account.journal'].browse(int(values['journal_id']))
-        currency_id = journal.default_credit_account_id.currency_id.id or journal.default_credit_account_id.company_currency_id.id
-        # Move line
-        move_line = self.env['account.move.line'].browse(values['line_cr_ids']).sorted(key=lambda r: r.id)
-        #company
-        company = self.env['res.company'].browse(int(values['company']))
-        #partner
-        partner = self.env['res.partner'].browse(int(values['partner_id']))
-        #invoice
-        invoice = self.env['account.invoice'].browse(int(values['invoice']))
-
-        line_cr_ids = []
-        amount = float(values['amount'])
-
-        for line in move_line:
-            line_cr_ids.append([0, False, {
-                'date_due': line.date_maturity,
-                'account_id': line.account_id.id,
-                'date_original': line.move_id.date,
-                'move_line_id': line.id,
-                'amount_original': abs(line.credit or line.debit or 0.0),
-                'amount_unreconciled': abs(line.amount_residual),
-                'amount': min(abs(amount), line.amount_residual),
-                'reconcile': line.move_id.date <= line.date_maturity,
-                'currency_id': currency_id
-            }])
-            amount -= min(abs(amount), line.amount_residual)
-
-        values = {
-                'reference': values['reference'],
-                'type': 'receipt',
-                'journal_id': journal.id,
-                'company_id': company.id,
-                'pre_line': True,
-                'amount': float(values['amount']),
-                'period_id': int(period.id),
-                'date': fields.Date.context_today(self),
-                'partner_id': partner.id,
-                'account_id': journal.default_credit_account_id.id,
-                'currency_id': currency_id,
-                'line_cr_ids': line_cr_ids
-            }
-
-        account_voucher.create(values)
-        # account_voucher.action_move_line_create()
-
-        # Si no tiene deuda actualizar  la factura  a pagada
-        if  invoice.residual <= 0:
-            invoice.write({
-                'state': 'paid'
-            })
-
-        # Usuario id
-        user = self.env.user
-
-        # Fecha del servidor
-        today = fields.Date.context_today(self)
-        # Crea la linea en la caja del pago realizado
-        bank_statement_line = [[0, False, {
-            'name': account_voucher.reference,
-            'partner_id': account_voucher.partner_id.id,
-            'amount': account_voucher.amount,
-            'voucher_id': account_voucher.id,
-            'journal_id': account_voucher.journal_id.id,
-            'account_id': account_voucher.account_id.id,
-            'journal_entry_id': account_voucher.move_id.id,
-            'currency_id': account_voucher.currency_id.id,
-            'ref': 'NP'
-        }]]
-
-        # Consultar Caja  Abierta, Método de Pagos, Fecha de Hoy
-        bank_statement = self.env['account.bank.statement'].search([('journal_id', '=', [journal.id]), ('date', '=', today)])
-
-        bank = {
-            'journal_id': account_voucher.journal_id.id,
-            'period_id': account_voucher.period_id.id,
-            'date': today,
-            'user_id': user.id,
-            'state': 'open' if account_voucher.journal_id.type == 'cash' else 'draft',
-            'line_ids':bank_statement_line
-        }
-
-        if bank_statement:
-            if len(bank_statement) == 1:
-                 bank_statement.write(bank)
-            else:
-                bank_statement[len(bank_statement) -1].write(bank)
-        else:
-            bank_statement = bank_statement.create(bank)
-
-        # Retorna el ticket de pagos
-        return {
-            'action_id': self.env['ir.actions.report.xml'].search([('report_name', '=', 'voucher_print.report_voucher')]).id,
-            'voucher_id': account_voucher.id
-        }

+ 0 - 63
models/payment_journal.py

@@ -1,63 +0,0 @@
-# -*- coding: utf-8 -*-
-from openerp import api, fields, models
-import json
-
-class PaymentJournal(models.Model):
-    _inherit = 'account.journal'
-
-    @api.model
-    def get_paymentsJournals(self):
-        domain =[
-            ('active', '=', True),
-            ('type', 'in',['bank', 'cash']),
-            ('default_credit_account_id.currency_id', '=', False)
-        ]
-        paymentsJournals = []
-
-        for journal in self.env['account.journal'].search(domain, order="id"):
-            if not (journal.store_ids >= self.env.user.store_ids):
-                continue
-
-            paymentsJournals.append({
-                'id': journal.id,
-                'name': journal.name,
-                'display_name': journal.display_name,
-                'code': journal.code,
-                'cash_control': journal.cash_control,
-                'type': journal.type,
-                'currency': {
-                    'id': journal.currency.id,
-                    'name': journal.currency.name,
-                    'display_name': journal.currency.display_name,
-                    'symbol': journal.currency.symbol,
-                    'rate_silent': journal.currency.rate_silent
-                },
-                'default_credit_account':{
-                    'id': journal.default_credit_account_id.id,
-                    'name': journal.default_credit_account_id.name,
-                    'display_name': journal.default_credit_account_id.display_name,
-                    'code': journal.default_credit_account_id.code,
-                    'exchange_rate': journal.default_credit_account_id.exchange_rate,
-                    'foreign_balance': journal.default_credit_account_id.foreign_balance,
-                    'reconcile': journal.default_credit_account_id.reconcile,
-                    'debit': journal.default_credit_account_id.debit,
-                    'credit': journal.default_credit_account_id.credit,
-                    'currency_mode': journal.default_credit_account_id.currency_mode,
-                    'company_currency':{
-                        'id': journal.default_credit_account_id.company_currency_id.id,
-                        'name': journal.default_credit_account_id.company_currency_id.name,
-                        'display_name': journal.default_credit_account_id.company_currency_id.display_name,
-                        'symbol': journal.default_credit_account_id.company_currency_id.symbol,
-                        'rate_silent': journal.default_credit_account_id.company_currency_id.rate_silent
-                    },
-                    'currency':{
-                        'id': journal.default_credit_account_id.currency_id.id,
-                        'name': journal.default_credit_account_id.currency_id.name,
-                        'display_name': journal.default_credit_account_id.currency_id.display_name,
-                        'symbol': journal.default_credit_account_id.currency_id.symbol,
-                        'rate_silent': journal.default_credit_account_id.currency_id.rate_silent
-                    },
-                }
-            })
-
-        return paymentsJournals

+ 0 - 20
models/res_company.py

@@ -1,20 +0,0 @@
-from openerp import api, fields, models
-
-class ResCompany(models.Model):
-    _inherit = 'res.company'
-
-    @api.model
-    def get_paymentsCompany(self):
-        user = self.env.user
-
-        return {
-            'id': user.company_id.id,
-            'name': user.company_id.name,
-            'currency': {
-                'id': user.company_id.currency_id.id,
-                'name': user.company_id.currency_id.name,
-                'display_name': user.company_id.currency_id.display_name,
-                'symbol': user.company_id.currency_id.symbol
-            },
-            'today' : fields.Date.context_today(self)
-        }

+ 0 - 81
models/res_partner.py

@@ -1,81 +0,0 @@
-from openerp import api, fields, models
-from datetime import  datetime, date, time, timedelta
-
-class ResPartner(models.Model):
-    _inherit = 'res.partner'
-
-    @api.model
-    def get_partners(self):
-        domain = [('customer', '=', True), ('active', '=', True), ('credit', '>', 0)]
-        partners = []
-
-        for customer in self.env['res.partner'].search(domain):
-            categories = []
-            invoices = []
-            partner_invoice = []
-
-            for category in customer.category_id:
-                categories.append({
-                    'id': category.id,
-                    'name': category.name,
-                    'display_name': category.display_name
-                })
-
-            for invoice_ids in customer.invoice_ids:
-                if invoice_ids.state == 'open':
-                    partner_invoice.append(invoice_ids.id)
-
-            if customer.is_company == True:
-                for child in customer.child_ids:
-                    for invoice_ids in child.invoice_ids:
-                        if invoice_ids.state == 'open':
-                            partner_invoice.append(invoice_ids.id)
-
-            for invoice in self.env['account.invoice'].browse(partner_invoice):
-                movelines = []
-                moves = []
-                currency_symbol = ""
-
-                for move in invoice.move_id:
-                    for moveline in move.line_id:
-                        if moveline.amount_residual > 0 and moveline.state != "draft" and moveline.credit <= 0:
-                            movelines.append({
-                                'id': moveline.id,
-                                'amount_residual': moveline.amount_residual,
-                                'credit': moveline.credit,
-                                'debit': moveline.debit,
-                                'date_maturity': moveline.date_maturity,
-                                'invoice': invoice.id
-                            })
-
-                for currency in invoice.currency_id:
-                    currency_symbol=currency.symbol
-
-                if invoice.state == 'open':
-                    invoices.append({
-                        'id': invoice.id,
-                        'number': invoice.number,
-                        'date_invoice': invoice.date_invoice,
-                        'amount_total': invoice.amount_total,
-                        'residual': invoice.residual,
-                        'moveLines': movelines,
-                        'currency_symbol' : currency_symbol
-                    })
-
-            partners.append({
-                'id': customer.id,
-                'name': customer.name,
-                'display_name': customer.display_name,
-                'ruc': customer.ruc,
-                'image_medium': customer.image_medium,
-                'phone': customer.phone,
-                'mobile': customer.mobile,
-                'email': customer.email,
-                'credit': customer.credit,
-                'credit_limit': customer.credit_limit,
-                'categories': categories,
-                'invoices': invoices,
-                'date_server': str(datetime.now().date())
-            })
-
-        return partners

+ 8 - 1
src/Payments.vue

@@ -14,7 +14,14 @@
 <script>
 
 	import { mapActions } from 'vuex'
-	import { REMOVE_MOVE_PAYMENTS_ALL, PAYMENTS_PROCESS, CHECK_CUSTOMER, CHECK_INVOICE, CHECK_MOVE, CHECK_PAYMENTS } from '@/constants/actionTypes'
+	import {
+		REMOVE_MOVE_PAYMENTS_ALL,
+		PAYMENTS_PROCESS,
+		CHECK_CUSTOMER,
+		CHECK_INVOICE,
+		CHECK_MOVE,
+		CHECK_PAYMENTS
+	} from '@/constants/actionTypes'
 
 	import { FormWizard, TabContent } from 'vue-form-wizard'
 	import 'vue-form-wizard/dist/vue-form-wizard.min.css'

+ 16 - 9
src/components/filters/currency.js

@@ -1,33 +1,40 @@
 /**
  * 
  */
-const currency = (value = 0, symbol = '$', symbolPosition = 'before', thousandsSeparator = '.', decimalPlaces = 2, decimalSeparator = ',', decimalZeros = false) => {
+const currency = (value = 0, options = {}) => {
     value = value.toString()
 
-    if (decimalPlaces > 2) {
-        decimalPlaces = 2
+    if (!(options instanceof Object)) {
+        options = {}
     }
 
-    if (!!(`${thousandsSeparator}${decimalSeparator}`).replace(/\.,|,\./g, '')) {
+    options.symbol = options.symbol || '$'
+    options.position = options.position || 'before'
+    options.thousandsSeparator = options.thousandsSeparator || '.'
+    options.decimalPlaces = options.decimalPlaces >= 0 || options.decimalPlaces <= 2 ? options.decimalPlaces : 2
+    options.decimalSeparator = options.decimalSeparator || ','
+    options.decimalZeros = !!options.decimalZeros
+
+    if (!!(`${options.thousandsSeparator}${options.decimalSeparator}`).replace(/\.,|,\./g, '')) {
         throw new Error('Same thousands and decimal separator is not allowed')
     }
 
     value = value.split('.')
 
-    value[0] = value[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandsSeparator}`)
+    value[0] = value[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${options.thousandsSeparator}`)
 
     if (!!value[1]) {
-        value[1] = Number.parseFloat(`1.${value[1]}e${decimalPlaces}`)
+        value[1] = Number.parseFloat(`1.${value[1]}e${options.decimalPlaces}`)
         value[1] = Math.round(value[1]).toString().replace(/^1/, '')
     }
 
-    value = value.join(decimalSeparator)
+    value = value.join(options.decimalSeparator)
 
-    if (!decimalZeros) {
+    if (!options.decimalZeros) {
         value = value.replace(/([\.|,]\d)0$/, '$1')
     }
 
-    return symbolPosition === 'before' ? `${symbol} ${value}` : `${value} ${symbol}`
+    return options.position === 'before' ? `${options.symbol} ${value}` : `${value} ${options.symbol}`
 }
 
 export default currency

+ 2 - 2
src/components/froms/CustomerDetails.vue

@@ -24,10 +24,10 @@
                 hr
             .form-item-payments
                 label.form-label Débito
-                input.form-input(:value="customer.credit | currency(currencyCompany.symbol, symbolPosition)" readonly)
+                input.form-input(:value="customer.credit | currency(...currencyCompany)" readonly)
             .form-item-payments
                 label.form-label Crédito
-                input.form-input(:value="customer.creditLimit | currency(currencyCompany.symbol)" readonly)
+                input.form-input(:value="customer.creditLimit | currency(...currencyCompany)" readonly)
 </template>
 
 <script>

+ 2 - 2
src/components/invoices/InvoiceCard.vue

@@ -5,10 +5,10 @@
         .invoice-amount
             .invoice-total
                 h2.amount-label Total
-                h2.invoice-total-value {{ amountTotal | currency(currencyCompany.symbol) }}
+                h2.invoice-total-value {{ amountTotal | currency(...currencyCompany) }}
             .invoice-total
                 h2.amount-label  Saldo
-                h2.invoice-saldo-value {{ residual | currency(currencyCompany.symbol)}}
+                h2.invoice-saldo-value {{ residual | currency(...currencyCompany)}}
 </template>
 
 <script>

+ 1 - 0
src/components/invoices/InvoicesGrid.vue

@@ -19,6 +19,7 @@
                 default: {
                     name: '',
                     symbol: '',
+                    position:'before',
                     rateSilent: 0,
                     thousandsSeparator: '.',
                     decimalSeparator: ',',

+ 15 - 6
src/components/moveLine/MoveLineCard.vue

@@ -1,13 +1,15 @@
 <template lang="pug">
-    .card-move-line(@click='onClick' :class="{ 'selected-move': isSelected }")
+    //- .card-move-line(@click='onClick' :class="{ 'selected-move': isSelected }")
+        //- (v-bind:class="{'move-card-disable': moveDisable() }")
+    .card-move-line(@click='onClick' :class="{ 'move-card-disable': isDisable}")
         h2.move-date Vencimiento {{ dateMaturity }}
         .move-amount
             .move-total
                 h2.move-amount-label Total
-                h2.move-total-value {{ debit | currency(currencyCompany.symbol)}}
+                h2.move-total-value {{ debit | currency(...currencyCompany)}}
             .move-total
                 h2.move-amount-label  Saldo
-                h2.move-saldo-value {{ amountResidual | currency(currencyCompany.symbol)}}
+                h2.move-saldo-value {{ amountResidual | currency(...currencyCompany)}}
 </template>
 
 <script>
@@ -29,11 +31,16 @@
                 type: Boolean,
                 default: true
             },
+            isDisable: {
+                type: Boolean,
+                default: true
+            },
             currencyCompany: {
                 type: Object,
                 default: {
                     name: '',
                     symbol: '₲',
+                    position: 'before',
                     rateSilent: 0,
                     thousandsSeparator: '.',
                     decimalSeparator: ',',
@@ -43,6 +50,7 @@
         },
         methods: {
             onClick() {
+                if (this.isDisable === false)
                 this.$emit('onClick')
             }
         }
@@ -55,12 +63,14 @@
         width: 245px
         height: 125px
         margin: 5px
-        border: 1px solid #d3d3d3
+        border: 1px solid $app-border-color
         display: inline-block
         position: relative
         &.selected-move
             transition-duration: 300ms
             border-bottom: 3px solid $app-main-color
+        &.move-card-disable
+            background: #f3f3f3
         &:hover
             cursor: pointer
         .move-date
@@ -88,12 +98,11 @@
                     width: 75px
                     height: 30px
                     float: left
-                    // text-align: right
                     font-size: 10pt
                     font-weight: bold
                     margin: 0px
                     padding: 10px
-                    color: #ccc
+                    color: #9e9e9e
                 .move-total-value, .move-saldo-value
                     width: calc(100% - 75px)
                     float: right

+ 20 - 7
src/components/moveLine/MovePaymentsCard.vue

@@ -1,8 +1,8 @@
 <template lang="pug">
     li.move-lines-item
         h3.move-lines-item-maturity Venc. {{ item.dateMaturity }}
-        span.move-lines-item-subtotal {{ item.amountResidual | currency(currencyCompany.symbol)}}
-        .move-lines-item-options-wrapper(class="fa fa-trash" @click='onClickDelete')
+        span.move-lines-item-subtotal {{ item.amountResidual | currency(...currencyCompany)}}
+        .move-lines-item-options-wrapper(class="fa fa-trash" @click='onClickDelete' v-bind:class="{'move-payments-disable': moveDisable(item.dateMaturity) }")
 </template>
 
 <script>
@@ -14,6 +14,10 @@
                 type: Boolean,
                 default: true
             },
+            isDisable: {
+                type: Boolean,
+                default: true
+            },
             index: {
                 type: Number,
                 default: -1,
@@ -23,11 +27,16 @@
                 type: Object,
                 default: null
             },
+            items: {
+                type: Object,
+                default: []
+            },
             currencyCompany: {
                 type: Object,
                 default: {
                     name: '',
                     symbol: '₲',
+                    position: 'before',
                     rateSilent: 0,
                     thousandsSeparator: '.',
                     decimalSeparator: ',',
@@ -36,12 +45,16 @@
             }
         },
         methods: {
-            onClick() {
-                this.$emit('onClick')
-            },
             onClickDelete() {
+                if (this.isDisable === false)
                 this.$emit('onClickDelete', this.item)
-            }
+            },
+            moveDisable(date_maturity) {
+                let dateMax = moment(moment.max(this.items.map(item => {
+                    return moment(item.dateMaturity)
+                }))).valueOf()
+                 return dateMax > moment(date_maturity).valueOf() ? this.isDisable = true : this.isDisable = false
+            },
         }
     }
 </script>
@@ -92,7 +105,7 @@
                 font-size: 17px
             &.fa-trash:hover
                 color: #f44336
-            &.fa-trash-disable
+            &.move-payments-disable
                 color: #e6e6e6
                 &:hover
                     color: #e6e6e6

+ 8 - 1
src/components/moveLine/MovesGrid.vue

@@ -1,7 +1,7 @@
 <template lang="pug">
     .card-grid-wrapper-move
         .card-grid-move
-            card(v-for='item in items' :key='item.id' :amountResidual='item.amountResidual' :dateMaturity='item.dateMaturity' :debit='item.debit' :isSelected='item.id === selectedId' @onClick='onClickCard(item)')
+            card(v-for='item in items' :key='item.id' :amountResidual='item.amountResidual' :dateMaturity='item.dateMaturity' :debit='item.debit' :isSelected='item.id === selectedId' :isDisable='moveDisable(item.dateMaturity)' @onClick='onClickCard(item)')
 </template>
 
 <script>
@@ -30,6 +30,13 @@
             card
         },
         methods: {
+            moveDisable(date_maturity) {
+                let dateMaturity = moment(date_maturity).valueOf()
+                let dates = this.items.map(item => {
+                    return moment(item.dateMaturity).valueOf()
+                })
+                return  dates.findIndex(item => item >= dateMaturity) !== 0 ? true : false
+            },
             onClickCard(item) {
                 this.selectedId = item.id
                 this.$emit('onSelect', item)

+ 3 - 14
src/components/moveLine/SelectedMovesGrid.vue

@@ -1,10 +1,10 @@
 <template lang="pug">
     .move-Lines-wrapper
         .move-line-Card-items
-            card(v-for='(item, index) in items' :key='index' :index='index' :item='item'  @onClickDelete="onDeleteIntem" )
+            card(v-for='(item, index) in items' :key='index' :index='index' :item='item' :items='items'  @onClickDelete="onDeleteIntem" )
         .move-line-payments-total
             label.form-label-move-payments Total
-            input.form-input-move-payments(:value="total | currency" readonly)
+            input.form-input-move-payments(:value="total | currency(...currencyCompany)" readonly)
 </template>
 
 <script>
@@ -26,6 +26,7 @@
                 default: {
                     name: '',
                     symbol: '₲',
+                    position: 'before',
                     rateSilent: 0,
                     thousandsSeparator: '.',
                     decimalSeparator: ',',
@@ -37,22 +38,10 @@
             card
         },
         methods: {
-        //     getDescription(item) {
-        //         return (!!this.description && item[this.description]) || ''
-        //     },
-        //     onClickCard(item) {
-        //         this.selectedId = item.id
-        //         this.$emit('onSelect', item)
-        //     }
             onDeleteIntem(item) {
                 this.$emit('onDeleteIntem', item)
             }
         },
-        // data() {
-        //     return {
-        //         selectedId: -1
-        //     }
-        // }
     }
 </script>
 

+ 0 - 132
src/components/payments/Payment.vue

@@ -1,132 +0,0 @@
-<template lang="pug">
-    form.method-payment
-        //- .method-form-separator
-            h3 Detalle de Cliente
-            //- hr
-        //- .method-form-item
-        //-     label.method-form-label Cliente
-        //-     input.method-form-input(readonly :value="Fulano")
-        //- .method-form-separator
-        //-     h3 Detalle de pago
-        //-     hr
-        //- .method-form-item
-        //-     label.method-form-label Método de pago
-        //-     select.method-form-input(v-model="journal")
-        //-         option(v-for="journal in paymentsJournals" :value="journal") {{ journal.display_name}}
-        //- .method-form-item
-        //-     label.method-form-label Total
-        //-     input.method-form-input-number(readonly :value="getTotal()")
-        //- .method-form-item
-        //-     label.method-form-label Monto a Pagar
-        //-     input.method-form-input-number(:value="paid" v-model="paid" autofocus)
-        //- .method-form-item
-        //-     label.method-form-label Monto a Devolver
-        //-     input.method-form-input-number(readonly :value="0")
-</template>
-<script>
-
-    export default {
-        // computed: {
-        //     journal: {
-        //         get() {
-        //             return this.selectedPaymentsJournals
-        //         },
-        //         set(value) {
-        //             this.selectPaymentsJournal(value)
-        //         }
-        //     } ,
-        //     paid:{
-        //         get() {
-        //             return accounting.formatMoney(this.paymentAmount, this.companySymbol,0,'.',',')
-        //         },
-        //         set(value) {
-        //             value =  accounting.unformat(value,',')
-        //             this.changePaymentAmount(value)
-        //             this.residualCalculate()
-        //         }
-        //     },
-        //     ...mapGetters([
-        //         'selectedPartner',
-        //         'selectedPaymentsJournals',
-        //         'total',
-        //         'paymentsJournals',
-        //         'companySymbol',
-        //         'paymentAmount'
-        //     ])
-        // },
-        // methods: {
-        //     getPartner() {
-        //         return !!this.selectedPartner ? this.selectedPartner.display_name : ''
-        //     },
-        //     getPartnerRuc() {
-        //         return !!this.selectedPartner ? this.selectedPartner.ruc : ''
-        //     },
-        //     getTotal() {
-        //         return accounting.formatMoney(this.total,this.companySymbol,0,'.',',')
-        //     },
-        //     residualCalculate() {
-        //         this.residual = this.paymentAmount >= this.total ? this.paymentAmount - this.total : 0
-        //     },
-        //     formatResidual() {
-        //         return accounting.formatMoney(this.residual, this.companySymbol, 0,'.',',')
-        //     },
-        //     ...mapActions([
-        //         'selectPaymentsJournal',
-        //         'changePaymentAmount'
-        //     ])
-        // },
-        // data() {
-        //     return {
-        //         residual: 0
-        //     }
-        // },
-        // mounted() {
-        //     this.changePaymentAmount(0)
-        // }
-
-    }
-</script>
-
-<style lang="sass">
-    .method-payment
-        width: calc(100% - 500px)
-        height: 100%
-        display: inline-block
-        background: #f5f5f5
-        vertical-align: top
-        padding: 15px 35px
-        margin-right: 50px
-        border-left: 1px solid #d3d3d3
-        // display: inline-block
-        // background: red
-
-        // .method-form-separator
-        //     h3
-        //         color: #9e9e9e
-        //         font:
-        //             size: 8pt
-        //     hr
-        //         margin-top: 5px
-        //
-        // .method-form-item
-        //     width: 100%
-        //     height: 45px
-        //     margin-bottom: 15px
-        //
-        //     .method-form-label
-        //         width: 250px
-        //         height: 45px
-        //         font:
-        //             size: 14pt
-        //
-        //     .method-form-input, .method-form-input-number
-        //         width: 350px
-        //         height: 45px
-        //         font:
-        //             size: 14pt
-        //         border-radius: 0
-        //
-        //     .method-form-input-number
-        //         text-align: right
-
-</style>

+ 5 - 4
src/components/payments/VoucherTicket.vue

@@ -17,16 +17,16 @@
                 .voucher-ticket-from-grid
                     .voucher-ticket-from-grid-item(v-for="line in items")
                         label.voucher-ticket-from-grid-item-left {{ line.dateMaturity }}
-                        label.voucher-ticket-from-grid-item-right {{ line.amountResidual | currency(currencyCompany.symbol) }}
+                        label.voucher-ticket-from-grid-item-right {{ line.amountResidual | currency(...currencyCompany) }}
                 .voucher-ticket-from-item-total
                     label.voucher-ticket-from-label-total Total
-                    label.voucher-ticket-from-input-total {{ totalPayments | currency(currencyCompany.symbol) }}
+                    label.voucher-ticket-from-input-total {{ totalPayments | currency(...currencyCompany) }}
                 .voucher-ticket-from-item-total
                     label.voucher-ticket-from-label-total Pagado
-                    label.voucher-ticket-from-input-total {{ paymentTotal | currency(currencyCompany.symbol) }}
+                    label.voucher-ticket-from-input-total {{ paymentTotal | currency(...currencyCompany) }}
                 .voucher-ticket-from-item-total
                     label.voucher-ticket-from-label-total Saldo
-                    label.voucher-ticket-from-input-total {{ paymentBalance | currency(currencyCompany.symbol) }}
+                    label.voucher-ticket-from-input-total {{ paymentBalance | currency(...currencyCompany) }}
 </template>
 
 <script>
@@ -61,6 +61,7 @@
                 default: {
                     name: '',
                     symbol: '',
+                    position: 'before',
                     rateSilent: 0,
                     thousandsSeparator: '.',
                     decimalSeparator: ',',

+ 7 - 5
src/components/steps/Invoices.vue

@@ -1,14 +1,14 @@
 <template lang="pug">
     .payments-step
         .invoice-step
-            searcher(:items='invoices' :keys="['number']")
-            grid(:items='invoices' @onSelect='selectInvoice' :currencyCompany='currencyCompany')
+            searcher(:items='invoices' :keys="['number']" @onSearch="filterPaymentsInvoice")
+            grid(:items='invoicesVisible' @onSelect='selectInvoice' :currencyCompany='currencyCompany')
 </template>
 
 <script>
     import { mapGetters, mapActions } from 'vuex'
     import { Searcher } from '@@/common'
-    import { SELECT_INVOICE } from '@/constants/actionTypes'
+    import { SELECT_INVOICE, FILTER_PAYMENTS_INVOICE } from '@/constants/actionTypes'
 
     import Grid from '@@/invoices/InvoicesGrid'
 
@@ -19,10 +19,12 @@
         },
         computed: mapGetters([
             'invoices',
-            'currencyCompany'
+            'currencyCompany',
+            'invoicesVisible'
         ]),
         methods: mapActions([
-            SELECT_INVOICE
+            SELECT_INVOICE,
+            FILTER_PAYMENTS_INVOICE
         ]),
     }
 </script>

+ 3 - 3
src/components/steps/MethodPayment.vue

@@ -18,13 +18,13 @@
                     option(v-for="journal in journals" :value="journal") {{ journal.displayName }}
             .method-form-item
                 label.method-form-label Total
-                input.method-form-input(readonly :value="movesPaymentsTotal | currency")
+                input.method-form-input(readonly :value="movesPaymentsTotal | currency(...currencyCompany)")
             .method-form-item
                 label.method-form-label  Monto a Pagar
                 input.method-form-input(v-model='paid' autofocus)
             .method-form-item
                 label.method-form-label Monto a Devolver
-                input.method-form-input(readonly :value='paymentsReturned | currency')
+                input.method-form-input(readonly :value='paymentsReturned | currency(...currencyCompany)')
 </template>
 
 <script>
@@ -47,7 +47,7 @@
             },
             paid: {
                 get() {
-                    let formatted = this.$options.filters.currency(this.paidTotal)
+                    let formatted = this.$options.filters.currency(this.paidTotal, {...this.currencyCompany})
                     return !!this.paidTotal ? formatted : formatted.replace(/\d/, '')
                 },
                 set(value) {

+ 7 - 8
src/components/steps/Partner.vue

@@ -1,21 +1,18 @@
 <template lang="pug">
     .payments-step
         .partner-step
-            //- .partner-left
             .partner-selector
-                searcher(:items='customers' :keys="['name']")
-                card-grid(:items='customers' :loading='loadingCustomers' @onSelect='selectPaymentsCustomer')
+                searcher(:items='customers' :keys="['name','ruc']" @onSearch='filterPaymentsCustomers')
+                card-grid(:items='customerVisible' :loading='loadingCustomers' @onSelect='selectPaymentsCustomer')
             transition(name="slide-fade")
                 customer-details(v-if='!!selectedCustomer' :customer='selectedCustomer' :currencyCompany='currencyCompany')
 </template>
 
 <script>
-
     import { mapGetters, mapActions } from 'vuex'
     import { Searcher, CardGrid } from '@@/common'
     import CustomerDetails from '@@/froms/CustomerDetails'
-
-    import { SELECT_PAYMENTS_CUSTOMER } from '@/constants/actionTypes'
+    import { SELECT_PAYMENTS_CUSTOMER, FILTER_PAYMENTS_CUSTOMERS } from '@/constants/actionTypes'
 
     export default {
         components: {
@@ -27,10 +24,12 @@
             'customers',
             'loadingCustomers',
             'selectedCustomer',
-            'currencyCompany'
+            'currencyCompany',
+            'customerVisible'
         ]),
         methods: mapActions([
-            SELECT_PAYMENTS_CUSTOMER
+            SELECT_PAYMENTS_CUSTOMER,
+            FILTER_PAYMENTS_CUSTOMERS
         ])
     }
 </script>

+ 4 - 2
src/constants/actionTypes.js

@@ -17,10 +17,12 @@ const INIT_PAYMENTS_COMPANY = 'initPaymentsCompany'
  */
 const INIT_PAYMENTS_CUSTOMERS = 'initPaymentsCustomers'
 const SELECT_PAYMENTS_CUSTOMER = 'selectPaymentsCustomer'
+const FILTER_PAYMENTS_CUSTOMERS = 'filterPaymentsCustomers'
 /* invoice */
 const SELECT_CUSTOMER_INVOICES = 'selectCustomerInvoices'
 const SELECT_INVOICE = 'selectInvoice'
 const ADD_MOVE_IN_INVOICE = 'addMoveInInvoice'
+const FILTER_PAYMENTS_INVOICE ='filterPaymentsInvoice'
 /* Move Line */
 const SELECT_MOVE_INVOICE = 'selectMoveInvoice'
 const SELECT_MOVE = 'selectMove'
@@ -47,8 +49,8 @@ export {
     PAYMENTS_NOTIFY, INIT_PAYMENTS, EXPLODE_DATA, PAYMENTS_PROCESS, //initial
     INIT_PAYMENTS_DATE, //date
     INIT_PAYMENTS_USER, INIT_PAYMENTS_COMPANY, //user
-    INIT_PAYMENTS_CUSTOMERS, SELECT_PAYMENTS_CUSTOMER, //customer
-    SELECT_CUSTOMER_INVOICES, SELECT_INVOICE, ADD_MOVE_IN_INVOICE, //Customer -invoice
+    INIT_PAYMENTS_CUSTOMERS, SELECT_PAYMENTS_CUSTOMER, FILTER_PAYMENTS_CUSTOMERS, //customer
+    SELECT_CUSTOMER_INVOICES, SELECT_INVOICE, ADD_MOVE_IN_INVOICE,FILTER_PAYMENTS_INVOICE, //Customer -invoice
     SELECT_MOVE_INVOICE, SELECT_MOVE,REMOVE_MOVE_PAYMENTS, REMOVE_MOVE_PAYMENTS_ALL, //Customer -Move
     INIT_PAYMENTS_JOURNALS, SELECT_JOURNAL, CHANGE_INITIAL_PAID,//Journal
     INIT_PAYMENTS_CURRENCIES, //currency

+ 7 - 3
src/constants/mutationTypes.js

@@ -19,11 +19,13 @@ const SET_SELECTED_CURRENCY_COMPANY = 'setSelectedCurrencyCompany'
 const SET_CUSTOMERS = 'setCustomers'
 const SET_LOADING_CUSTOMERS = 'setLoadingCustomers'
 const SET_SELECTED_CUSTOMER = 'setSelectCustomer'
+const SET_FILTER_PAYMENTS_CUSTOMERS = 'setFilterPaymentsCustomers'
 /*invoices*/
 const SET_INVOICES = 'setInvoices'
 const SET_SELECTED_INVOICE = 'setSelectedInvoice'
 const SET_SELECTED_CURRENCY_INVOICE = 'setSelectedCurrencyInvoice'
 const SET_MOVE_IN_INVOICE = 'setMoveInInvoice'
+const SET_FILTER_PAYMENTS_INVOICE = 'setFilterPaymentsInvoice'
 /* Moves Lines */
 const SET_MOVES = 'setMoves'
 const SET_SELECTED_MOVE_LINE = 'setSelectedMoveLine'
@@ -31,6 +33,8 @@ const SET_SELECTED_MOVE_PAYMENTS = 'setSelectedMovePayments'
 const REMOVE_MOVE_LINE = 'removeMoveLine'
 const REMOVE_PAYMENTS_MOVE = 'removePaymentsMove'
 const SET_TOTAL_MOVE_PAYMENTS = 'setTotalMovePayments'
+const SET_ORDER_MOVE_LINE = 'setOrderMoveLine'
+const SET_ORDER_PAYMENTS_MOVE = 'setOrderPaymentsMove'
 /**
  * [JOURNALS]
  * @type {String}
@@ -50,9 +54,9 @@ const SET_LOADING_CURRENCIES = 'setLoadingCurrencies'
 export {
     SET_DATE, SET_LOADING_DATE, //Date
     SET_USER, SET_LOADING_USER, SET_SELECTED_COMPANY, SET_SELECTED_CURRENCY_COMPANY, //User
-    SET_CUSTOMERS, SET_LOADING_CUSTOMERS, SET_SELECTED_CUSTOMER, //customer
-    SET_INVOICES, SET_SELECTED_INVOICE, SET_SELECTED_CURRENCY_INVOICE, SET_MOVE_IN_INVOICE, //customer - invoice
-    SET_MOVES, SET_SELECTED_MOVE_LINE, SET_SELECTED_MOVE_PAYMENTS, REMOVE_MOVE_LINE, REMOVE_PAYMENTS_MOVE, SET_TOTAL_MOVE_PAYMENTS,//customer -Move
+    SET_CUSTOMERS, SET_LOADING_CUSTOMERS, SET_SELECTED_CUSTOMER, SET_FILTER_PAYMENTS_CUSTOMERS, //customer
+    SET_INVOICES, SET_SELECTED_INVOICE, SET_SELECTED_CURRENCY_INVOICE, SET_MOVE_IN_INVOICE,SET_FILTER_PAYMENTS_INVOICE, //customer - invoice
+    SET_MOVES, SET_SELECTED_MOVE_LINE, SET_SELECTED_MOVE_PAYMENTS, REMOVE_MOVE_LINE, REMOVE_PAYMENTS_MOVE, SET_TOTAL_MOVE_PAYMENTS,SET_ORDER_MOVE_LINE ,SET_ORDER_PAYMENTS_MOVE, //customer -Move
     SET_JOURNALS, SET_LOADING_JOURNALS, SET_SELECTED_JOURNAL, SET_PAID_TOTAL,//Journal
     SET_CURRENCIES, SET_LOADING_CURRENCIES //Currency
 }

+ 0 - 1
src/store/modules/company.js

@@ -50,7 +50,6 @@ const mutations = {
 }
 const actions = {
     [INIT_PAYMENTS_COMPANY] ({commit}, payload) {
-        console.log(payload);
         commit(SET_SELECTED_COMPANY,payload.company)
         commit(SET_SELECTED_CURRENCY_COMPANY, payload.currency)
     }

+ 33 - 4
src/store/modules/customers.js

@@ -1,16 +1,30 @@
-import { INIT_PAYMENTS_CUSTOMERS, SELECT_PAYMENTS_CUSTOMER, SELECT_CUSTOMER_INVOICES } from '@/constants/actionTypes'
-import { SET_CUSTOMERS, SET_LOADING_CUSTOMERS, SET_SELECTED_CUSTOMER } from '@/constants/mutationTypes'
+import {
+    INIT_PAYMENTS_CUSTOMERS,
+    SELECT_PAYMENTS_CUSTOMER,
+    SELECT_CUSTOMER_INVOICES,
+    FILTER_PAYMENTS_CUSTOMERS
+} from '@/constants/actionTypes'
+
+import {
+    SET_CUSTOMERS,
+    SET_LOADING_CUSTOMERS,
+    SET_SELECTED_CUSTOMER,
+    SET_FILTER_PAYMENTS_CUSTOMERS
+} from '@/constants/mutationTypes'
 
 const initialState = {
-    customers: null,
+    customers: [],
+    filterCustomers: [],
     loadingCustomers: false,
     selectedCustomer: null
+
 }
 
 const state = {
     customers: initialState.customers,
     loadingCustomers: !initialState.loadingCustomers,
-    selectedCustomer: initialState.selectedCustomer
+    selectedCustomer: initialState.selectedCustomer,
+    filterCustomers: initialState.filterCustomers
 }
 
 const getters = {
@@ -37,6 +51,9 @@ const getters = {
      */
     selectedCustomer(state) {
         return state.selectedCustomer
+    },
+    customerVisible (state) {
+        return state.filterCustomers.length === 0 ? state.customers : state.filterCustomers
     }
 }
 const mutations = {
@@ -63,6 +80,9 @@ const mutations = {
      */
     [SET_SELECTED_CUSTOMER] (state, payload) {
         state.selectedCustomer = payload
+    },
+    [SET_FILTER_PAYMENTS_CUSTOMERS] (state, payload) {
+        state.filterCustomers = payload
     }
 
 }
@@ -83,7 +103,16 @@ const actions = {
     [SELECT_PAYMENTS_CUSTOMER] ({ commit, dispatch }, payload ) {
         commit(SET_SELECTED_CUSTOMER, payload)
         dispatch(SELECT_CUSTOMER_INVOICES, payload.invoices)
+    },
+    /**
+     * @param {*} param0
+     * @param {*} payload
+     *
+     */
+    [FILTER_PAYMENTS_CUSTOMERS] ({ commit }, payload) {
+        commit(SET_FILTER_PAYMENTS_CUSTOMERS, payload)
     }
+
 }
 
 export default {

+ 45 - 4
src/store/modules/invoices.js

@@ -1,8 +1,22 @@
-import { SELECT_CUSTOMER_INVOICES, SELECT_INVOICE, SELECT_MOVE_INVOICE, ADD_MOVE_IN_INVOICE } from '@/constants/actionTypes'
-import { SET_INVOICES, SET_SELECTED_INVOICE, SET_SELECTED_CURRENCY_INVOICE, SET_MOVE_IN_INVOICE } from '@/constants/mutationTypes'
+import {
+    SELECT_CUSTOMER_INVOICES,
+    SELECT_INVOICE,
+    SELECT_MOVE_INVOICE,
+    ADD_MOVE_IN_INVOICE,
+    FILTER_PAYMENTS_INVOICE
+} from '@/constants/actionTypes'
+
+import {
+    SET_INVOICES,
+    SET_SELECTED_INVOICE,
+    SET_SELECTED_CURRENCY_INVOICE,
+    SET_MOVE_IN_INVOICE,
+    SET_FILTER_PAYMENTS_INVOICE
+} from '@/constants/mutationTypes'
 
 const initialState = {
-    invoices: null,
+    invoices: [],
+    filterPaymentsInvoice: [],
     currencyInvoice: null,
     selectedInvoice : null
 }
@@ -10,7 +24,8 @@ const initialState = {
 const state = {
     invoices: initialState.invoices,
     currencyInvoice: initialState.currencyInvoice,
-    selectedInvoice: initialState.selectedInvoice
+    selectedInvoice: initialState.selectedInvoice,
+    filterPaymentsInvoice: initialState.filterPaymentsInvoice
 }
 
 const getters = {
@@ -37,6 +52,15 @@ const getters = {
      */
     selectedInvoice(state) {
         return state.selectedInvoice
+    },
+    /**
+     * [invoicesVisible]
+     * @method invoicesVisible
+     * @param  {[type]}        state [description]
+     * @return {[type]}              [description]
+     */
+    invoicesVisible(state) {
+        return state.filterPaymentsInvoice.length === 0 ?state.invoices : state.filterPaymentsInvoice
     }
 }
 
@@ -89,6 +113,15 @@ const mutations = {
             if (movesFound) return
             state.selectedInvoice.moveLines = [payload.moveLine, ...state.selectedInvoice.moveLines]
         }
+    },
+    /**
+     * [filterPaymentsInvoice description]
+     * @type {[type]}
+     * @param  {[type]} state [description]
+     * @param  {[type]} payload [description]
+     */
+    [SET_FILTER_PAYMENTS_INVOICE] (state, payload) {
+        return state.filterPaymentsInvoice = payload
     }
 }
 
@@ -116,6 +149,14 @@ const actions = {
      */
     [ADD_MOVE_IN_INVOICE] ({ commit }, payload) {
         commit(SET_MOVE_IN_INVOICE, payload)
+    },
+    /**
+     *
+     * @param {*} param0
+     * @param {*} payload
+     */
+    [FILTER_PAYMENTS_INVOICE] ({ commit }, payload ){
+        commit(SET_FILTER_PAYMENTS_INVOICE, payload)
     }
 }
 

+ 42 - 3
src/store/modules/moveLines.js

@@ -1,5 +1,21 @@
-import { SELECT_MOVE_INVOICE, SELECT_MOVE, REMOVE_MOVE_PAYMENTS, ADD_MOVE_IN_INVOICE, REMOVE_MOVE_PAYMENTS_ALL } from '@/constants/actionTypes'
-import { SET_MOVES, SET_SELECTED_MOVE_LINE, SET_SELECTED_MOVE_PAYMENTS, REMOVE_MOVE_LINE, REMOVE_PAYMENTS_MOVE, SET_TOTAL_MOVE_PAYMENTS } from '@/constants/mutationTypes'
+import {
+    SELECT_MOVE_INVOICE,
+    SELECT_MOVE,
+    REMOVE_MOVE_PAYMENTS,
+    ADD_MOVE_IN_INVOICE,
+    REMOVE_MOVE_PAYMENTS_ALL
+} from '@/constants/actionTypes'
+
+import {
+    SET_MOVES,
+    SET_SELECTED_MOVE_LINE,
+    SET_SELECTED_MOVE_PAYMENTS,
+    REMOVE_MOVE_LINE,
+    REMOVE_PAYMENTS_MOVE,
+    SET_TOTAL_MOVE_PAYMENTS,
+    SET_ORDER_MOVE_LINE,
+    SET_ORDER_PAYMENTS_MOVE
+} from '@/constants/mutationTypes'
 
 const initialState = {
     moves : null,
@@ -138,6 +154,26 @@ const mutations = {
             total = total + item.amountResidual
         })
         state.movesPaymentsTotal = total
+    },
+    /**
+     * [actions description]
+     * @type {Object}
+     * @param  {[type]} state [description]
+     */
+    [SET_ORDER_MOVE_LINE] (state) {
+        state.moves =  state.moves.sort((a, b) => {
+            return a.dateMaturity > b.dateMaturity
+        })
+    },
+    /**
+     * [actions description]
+     * @type {Object}
+     * @param  {[type]} state [description]
+     */
+    [SET_ORDER_PAYMENTS_MOVE] (state) {
+        state.movesPayments = state.movesPayments.sort((a, b) => {
+            return a.dateMaturity > b.dateMaturity
+        })
     }
 }
 
@@ -149,6 +185,7 @@ const actions = {
      */
     [SELECT_MOVE_INVOICE] ({ commit }, payload) {
         commit(SET_MOVES, payload)
+        commit(SET_ORDER_MOVE_LINE)
     },
     /**
      * [SELECT_MOVE]
@@ -161,6 +198,7 @@ const actions = {
         /* Remover Move Line */
         commit(REMOVE_MOVE_LINE, payload)
         commit(SET_TOTAL_MOVE_PAYMENTS)
+        commit(SET_ORDER_PAYMENTS_MOVE)
     },
     /**
      *
@@ -178,6 +216,7 @@ const actions = {
             mode: 'partial'
         })
 
+        commit(SET_ORDER_MOVE_LINE)
         commit(SET_TOTAL_MOVE_PAYMENTS)
     },
     /**
@@ -185,7 +224,6 @@ const actions = {
      * @type {[type]}
      */
     [REMOVE_MOVE_PAYMENTS_ALL] ({commit, dispatch, state}, payload) {
-        console.log(payload);
         if (!payload) return
 
         if (state.movesPayments.length === 0 ) return
@@ -204,6 +242,7 @@ const actions = {
             mode: 'full'
         })
 
+        commit(SET_ORDER_MOVE_LINE)
         commit(SET_TOTAL_MOVE_PAYMENTS)
     }
 }