Forráskód Böngészése

[ADD] Adicionado selección de factura y cuotas

adrielso 7 éve
szülő
commit
5004d3623a

+ 2 - 2
controllers/main.py

@@ -65,7 +65,7 @@ class PaymentsSales(http.Controller):
             'debit': supplier.debit,
             'invoices': [{
                 'id': invoice.id,
-                'numbre': invoice.number,
+                'number': invoice.number ,
                 'dateInvoice': invoice.date_invoice,
                 'amountTotal': invoice.amount_total,
                 'residual': invoice.residual,
@@ -86,7 +86,7 @@ class PaymentsSales(http.Controller):
                     'credit': line.credit,
                     'debit': line.debit,
                     'dateMaturity': line.date_maturity,
-                    'amountCurrency': line.amount_currency,
+                    'amountCurrency': (line.amount_currency * -1) if (line.amount_currency != 0) else line.credit,
                     'amountResidualCurrency': line.amount_residual_currency,
                     'currencyAmount': [{
                         'id': currency.id,

+ 8 - 1
src/App.vue

@@ -4,7 +4,9 @@
             tab-content(title="Quien es el proveedor ?")
                 supplier
             tab-content(title="Cual es la factura ?")
+                invoices
             tab-content(title="Que cuota es ?")
+                moves-lines
             tab-content(title="Como vas a pagar ?")
 </template>
 
@@ -13,13 +15,18 @@
     import { mapActions, mapGetters } from 'vuex'
     import { FormWizard, TabContent} from 'vue-form-wizard'
     import 'vue-form-wizard/dist/vue-form-wizard.min.css'
+    /* Step */
     import Supplier from '@@/steps/Supplier'
+    import Invoices from '@@/steps/Invoices'
+    import MovesLines from '@@/steps/MovesLines'
 
     export default {
         components: {
             TabContent,
             FormWizard,
-            Supplier
+            Supplier,
+            Invoices,
+            MovesLines
         },
         methods: mapActions([
             INIT_PAYMENTS_PURCHASES

+ 124 - 0
src/components/fromsInvoices/Card.vue

@@ -0,0 +1,124 @@
+<template lang="pug">
+    .invoice-card(@click='onClick' :class="{ 'selected-invoice': isSelected }")
+        h2.invoice-date {{ dateInvoice | dateFormat }}
+        h2.invoice-title {{ number }}
+        .invoice-amount
+            .invoice-total
+                h2.amount-label Total
+                h2.invoice-total-value {{ amountTotal | currency(...currency) }}
+            .invoice-total
+                h2.amount-label  Saldo
+                h2.invoice-saldo-value {{ residual | currency(...currency)}}
+</template>
+
+<script>
+    export default {
+        props: {
+            number: {
+                type: String,
+                default: ''
+            },
+            dateInvoice: {
+                type: String,
+                default: ''
+            },
+            amountTotal: {
+                type: Number,
+                default: 0
+            },
+            residual: {
+                type: Number,
+                default: 0
+            },
+            isSelected: {
+                type: Boolean,
+                default: true
+            },
+            currency: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    position:'before',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+        methods: {
+            onClick() {
+                this.$emit('onClick')
+            }
+        }
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+    .invoice-card
+        width: 250px
+        height: 125px
+        margin: 5px
+        border: 1px solid #d3d3d3
+        display: inline-block
+        position: relative
+        &.selected-invoice
+            transition-duration: 300ms
+            border-bottom: 3px solid $app-main-color
+        &:hover
+            cursor: pointer
+        .invoice-title
+            width: 100%
+            height: 30px
+            font-size: 12pt
+            text-align: center
+            margin-top: 25px
+            position: absolute
+            top: 0
+        .invoice-date
+            width: 100%
+            height: 30px
+            font-size: 9pt
+            text-align: right
+            padding-right: 10px
+            margin-top: 5px
+            position: absolute
+            top: 0
+        .invoice-amount
+            width: 100%
+            height: 70px
+            padding-top: 5px
+            margin: 0px
+            position: absolute
+            bottom: 0px
+            .invoice-total
+                width: calc(100% - 10px)
+                height: 30px
+                border-bottom: 1px solid $app-main-color
+                margin-left: 5px
+                margin-right: 5px
+                .amount-label
+                    width: 75px
+                    height: 30px
+                    float: left
+                    text-align: right
+                    font-size: 10pt
+                    font-weight: bold
+                    margin: 0px
+                    padding: 10px
+                    color: #ccc
+                .invoice-total-value, .invoice-saldo-value
+                    width: calc(100% - 75px)
+                    float: right
+                    text-align: right
+                    font-size: 10pt
+                    font-weight: bold
+                    margin: 0px
+                    padding: 10px
+                .invoice-total-value
+                    bottom: 23px
+                .invoice-saldo-value
+                    bottom: 0
+</style>

+ 46 - 0
src/components/fromsInvoices/Grid.vue

@@ -0,0 +1,46 @@
+<template lang="pug">
+    .card-grid-wrapper
+        card-grid
+            card(v-for='item in items' :key='item.id' :dateInvoice ='item.dateInvoice' :number='item.number' :amountTotal='item.amountTotal' :residual='item.residual' :isSelected='item.id === selectedId' @onClick='onClickCard(item)' :currency='item.currency')
+</template>
+
+<script>
+
+    import card from '@@/fromsInvoices/Card'
+
+    export default {
+        props: {
+            items: {
+                type: Array,
+                default: []
+            },
+        },
+        components: {
+            card
+        },
+        methods: {
+            getDescription(item) {
+                return (!!this.description && item[this.description]) || ''
+            },
+            onClickCard(item) {
+                this.selectedId = item.id
+                this.$emit('onSelect', item)
+            }
+        },
+        data() {
+            return {
+                selectedId: -1
+            }
+        }
+    }
+</script>
+
+<style lang="sass">
+    .card-grid-wrapper
+        width: 100%
+        height: calc(100% - 100px)
+        margin-top: 15px
+        overflow-y: auto
+        .card-grid
+            width: 100%
+</style>

+ 116 - 0
src/components/fromsMoveLine/CardMoveLines.vue

@@ -0,0 +1,116 @@
+<template lang="pug">
+    .card-move-line(@click='onClick' :class="{ 'move-card-disable': isDisable}")
+        h2.move-date Vencimiento {{ dateMaturity | dateFormat}}
+        .move-amount
+            .move-total
+                h2.move-amount-label Total
+                h2.move-total-value {{ debit | currency(...currency)}}
+            .move-total
+                h2.move-amount-label  Saldo
+                h2.move-saldo-value {{ amountResidual | currency(...currency)}}
+</template>
+
+<script>
+    export default {
+        props: {
+            dateMaturity: {
+                type: String,
+                default: ''
+            },
+            debit: {
+                type: Number,
+                default: 0
+            },
+            amountResidual: {
+                type: Number,
+                default: 0
+            },
+            isSelected: {
+                type: Boolean,
+                default: true
+            },
+            isDisable: {
+                type: Boolean,
+                default: true
+            },
+            currency: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    position:'before',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+        methods: {
+            onClick() {
+                if (this.isDisable === false)
+                this.$emit('onClick')
+            }
+        }
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+    .card-move-line
+        width: 245px
+        height: 125px
+        margin: 5px
+        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
+            width: 100%
+            height: 30px
+            font-size: 12pt
+            text-align: center
+            margin-top: 25px
+            position: absolute
+            top: 0
+        .move-amount
+            width: 100%
+            height: 70px
+            padding-top: 5px
+            margin: 0px
+            position: absolute
+            bottom: 0px
+            .move-total
+                width: calc(100% - 10px)
+                height: 30px
+                border-bottom: 1px solid $app-main-color
+                margin-left: 5px
+                margin-right: 5px
+                .move-amount-label
+                    width: 75px
+                    height: 30px
+                    float: left
+                    font-size: 10pt
+                    font-weight: bold
+                    margin: 0px
+                    padding: 10px
+                    color: #9e9e9e
+                .move-total-value, .move-saldo-value
+                    width: calc(100% - 75px)
+                    float: right
+                    text-align: right
+                    font-size: 10pt
+                    font-weight: bold
+                    margin: 0px
+                    padding: 10px
+                .move-total-value
+                    bottom: 23px
+                .move-saldo-value
+                    bottom: 0
+</style>

+ 113 - 0
src/components/fromsMoveLine/CardMovesPayments.vue

@@ -0,0 +1,113 @@
+<template lang="pug">
+    li.move-lines-item
+        h3.move-lines-item-maturity Venc. {{ item.dateMaturity | dateFormat}}
+        span.move-lines-item-subtotal {{ item.amountResidualCurrency | currency(...currency)}}
+        .move-lines-item-options-wrapper(class="fa fa-trash" @click='onClickDelete' v-bind:class="{'move-payments-disable': moveDisable(item.dateMaturity) }")
+</template>
+
+<script>
+    import { mapGetters, mapActions } from 'vuex'
+
+    export default {
+        props: {
+            isDelect: {
+                type: Boolean,
+                default: true
+            },
+            isDisable: {
+                type: Boolean,
+                default: true
+            },
+            index: {
+                type: Number,
+                default: -1,
+                required: true
+            },
+            item: {
+                type: Object,
+                default: null
+            },
+            items: {
+                type: Object,
+                default: []
+            },
+            currency: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    position:'before',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+        methods: {
+            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>
+
+<style lang="sass">
+    .move-lines-item
+        width: 100%
+        height: 50px
+        list-style: none outside none
+        border-bottom: 1px solid #d3d3d3
+        box-sizing: border-box
+        position: relative
+        &:nth-child(1)
+            border-top: 1px solid #d3d3d3
+        &:hover
+            transition-duration: 1s
+            border-bottom: 2px solid #7c7bad
+        .move-lines-item-maturity
+            width: 140px
+            height: 30px
+            margin: 12px 0 5px 0
+            float: left
+            padding-left: 5px
+            font:
+                size: 9pt
+        .move-lines-item-subtotal
+            width: 100px
+            height: 30px
+            margin-top: 12px
+            padding-right: 5px
+            text-align: right
+            float: left
+            font:
+                size: 9pt
+                weight: bold
+        .move-lines-item-options-wrapper
+            width: 27px
+            height: 30px
+            margin-top: 12px
+            float: right
+            display: flex
+            justify-content: center
+            &:hover
+                cursor: pointer
+            &.fa
+                padding-left: 2px
+                line-height: 20px
+                font-size: 17px
+            &.fa-trash:hover
+                color: #f44336
+            &.move-payments-disable
+                color: #e6e6e6
+                &:hover
+                    color: #e6e6e6
+
+</style>

+ 61 - 0
src/components/fromsMoveLine/GridMoves.vue

@@ -0,0 +1,61 @@
+<template lang="pug">
+    .card-grid-wrapper-move
+        .card-grid-move
+            card(v-for='item in items' :key='item.id' :amountResidual='item.amountResidualCurrency' :dateMaturity='item.dateMaturity' :debit='item.amountCurrency' :currency='currency' :isSelected='item.id === selectedId' :isDisable='moveDisable(item.dateMaturity)' @onClick='onClickCard(item)')
+</template>
+<script>
+    import card from '@@/fromsMoveLine/CardMoveLines'
+
+    export default {
+        props: {
+            items: {
+                type: Array,
+                default: []
+            },
+            currency: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    position:'before',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+        components: {
+            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)
+            }
+        },
+        data() {
+            return {
+                selectedId: -1
+            }
+        }
+    }
+</script>
+
+<style lang="sass">
+    .card-grid-wrapper-move
+        width: calc(100% - 300px)
+        height: calc(100% - 100px)
+        margin-top: 15px
+        overflow-y: auto
+        display: inline-block
+        .card-grid-move
+            width: 100%
+</style>

+ 83 - 0
src/components/fromsMoveLine/GridMovesPayments.vue

@@ -0,0 +1,83 @@
+<template lang="pug">
+    .move-Lines-wrapper
+        .move-line-Card-items
+            card(v-for='(item, index) in items' :key='index' :index='index' :item='item' :items='items' :currency='currency' @onClickDelete="onDeleteIntem" )
+        .move-line-payments-total
+            label.form-label-move-payments Total
+            input.form-input-move-payments(:value="total | currency(...currency)" readonly)
+</template>
+
+<script>
+
+    import card from '@@/fromsMoveLine/CardMovesPayments'
+    export default {
+        props: {
+            items: {
+                type: Array,
+                default: [],
+                required: true
+            },
+            total: {
+                type: Number,
+                default: 0
+            },
+            currency: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    position:'before',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+        components: {
+            card
+        },
+        methods: {
+            onDeleteIntem(item) {
+                this.$emit('onDeleteIntem', item)
+            }
+        },
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+    .move-Lines-wrapper
+        width: 300px
+        height: calc(100% - 100px)
+        margin-top: 15px
+        vertical-align: top
+        display: inline-block
+        border-left: 1px solid #e3e3e3
+        padding-left: 10px
+        .move-line-Card-items
+            width: 100%
+            // height: 365px
+            height: calc(100% - 60px)
+            border: 1px solid #d3d3d3
+            overflow-y: auto
+            overflow-x: hidden
+        .move-line-payments-total
+            width: 100%
+            height: 60px
+            border: 1px solid #d3d3d3
+            .form-label-move-payments
+                width: calc(30% - 5px)
+                height: 40px
+                font-size: 20pt
+                margin-left: 5px
+                margin-top: 5px
+                margin-bottom: 5px
+                color: $app-separator-color
+            .form-input-move-payments
+                width: calc(70% - 10px)
+                height: 40px
+                font-size: 20pt
+                margin: 5px
+                text-align: right
+</style>

+ 87 - 0
src/components/fromsSupplier/SupplierDetails.vue

@@ -0,0 +1,87 @@
+<template lang="pug">
+    .supplier-details
+        form.form-supplier-display
+            .form-separatoe
+                h3 Detalles Generales
+                hr
+            .form-item-payments
+                label.form-label Nombre
+                input.form-input(:value="supplier.name || ''" readonly)
+            .form-item-payments
+                label.form-label R.U.C/C.I.Nº
+                input.form-input(:value="supplier.ruc || ''" readonly)
+            .form-item-payments
+                label.form-label Celular
+                input.form-input(:value="supplier.phone || ''" readonly)
+            .form-item-payments
+                label.form-label Teléfono
+                input.form-input(:value="supplier.mobile || ''" readonly)
+            .form-item-payments
+                label.form-label Email
+                input.form-input(:value="supplier.email || ''" readonly)
+            .form-separatoe
+                h3 Finanzas
+                hr
+            .form-item-payments
+                label.form-label Total a pagar
+                input.form-input(:value="supplier.debit | currency(...currencyCompany)" readonly)
+</template>
+
+<script>
+
+    export default {
+        props: {
+            supplier: {
+                type: Object,
+                default: {
+                    name: '',
+                    ruc: '',
+                    phone: '',
+                    mobile: '',
+                    email: '',
+                    debit: 0
+                }
+            },
+            currencyCompany: {
+                type: Object,
+                default: {
+                    name: '',
+                    symbol: '',
+                    rateSilent: 0,
+                    thousandsSeparator: '.',
+                    decimalSeparator: ',',
+                    decimalPlaces: 0
+                }
+            }
+        },
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+    .supplier-details
+        width: 320px
+        height: 100%
+        .form-supplier-display
+            width: 320px
+            height: 100%
+            padding: 15px
+            .form-separatoe
+                h3
+                    color: $app-separator-color
+                    font-size: 8pt
+                hr
+            .form-item-payments
+                width: 100%
+                height: 35px
+                margin-bottom: 10px
+                .form-label
+                    width: 30%
+                    height: 35px
+                    font-size: 10pt
+                .form-input
+                    width: 70%
+                    height: 35px
+                    font-size: 10pt
+
+</style>

+ 40 - 0
src/components/steps/Invoices.vue

@@ -0,0 +1,40 @@
+<template lang="pug">
+    .payments-purchase-step
+        .supplier-invoices
+            searcher(:items="supplierInvoices" :keys="['number']" @onSearch="filterSupplierInvoices")
+            grid(:items='supplierInvoicesVisibles' @onSelect='selectSupplierInvoices')
+</template>
+
+<script>
+
+    import { mapGetters, mapActions } from 'vuex'
+    import { SELECT_SUPPLIER_INVOICES, FILTER_SUPPLIER_INVOICES } from '@/constants/actionTypes'
+
+    import { Searcher } from '@@/common'
+    import Grid from '@@/fromsInvoices/Grid'
+
+
+    export default {
+        components: {
+            Searcher,
+            Grid
+        },
+        computed: mapGetters ([
+            'supplierInvoices',
+            'supplierInvoicesVisibles'
+        ]),
+        methods: mapActions([
+            SELECT_SUPPLIER_INVOICES,
+            FILTER_SUPPLIER_INVOICES
+        ])
+    }
+</script>
+
+<style lang="sass">
+    .payments-purchase-step
+        .supplier-invoices
+            width: 100%
+            height: 100%
+            padding-right: 5px
+            display: inline-block
+</style>

+ 38 - 0
src/components/steps/MovesLines.vue

@@ -0,0 +1,38 @@
+<template lang="pug">
+    .payments-purchase-step
+        .move-step
+            grid-moves(:items="supplierMoveLines" @onSelect="selectSuppierMoveLines")
+            grid-payments(:items='supplierLinesPayments' :total="supplierPaymentsTotal" )
+            //- select-moves(:items='movesPayments' :total="movesPaymentsTotal" @onDeleteIntem='removeMovePayments' :currency='currencyInvoice')
+</template>
+
+<script>
+
+    import { mapActions, mapGetters } from 'vuex'
+    import { SELECT_SUPPLIER_MOVE_LINES } from '@/constants/actionTypes'
+
+    import GridMoves from '@@/fromsMoveLine/GridMoves'
+    import GridPayments from '@@/fromsMoveLine/GridMovesPayments'
+
+    export default {
+        components: {
+            GridMoves,
+            GridPayments
+        },
+        computed: mapGetters([
+            'supplierMoveLines',
+            'supplierLinesPayments',
+            'supplierPaymentsTotal'
+        ]),
+        methods: mapActions([
+            SELECT_SUPPLIER_MOVE_LINES
+        ])
+    }
+</script>
+
+<style lang="sass">
+    .move-step
+        width: 100%
+        height: 100%
+        padding-right: 5px
+</style>

+ 6 - 2
src/components/steps/Supplier.vue

@@ -5,22 +5,26 @@
                 searcher(:items="supplier" :keys="['name']" @onSearch="filterPaymentsPurchasesSupplier")
                 card-grid(:items="supplierVisible" :loading="loadingSupplier" @onSelect='selectPaymentsPurchasesSupplier')
             transition(name="slide-fade")
+                supplier-details(v-if="!!selectedSupplier" :supplier="selectedSupplier" )
 </template>
 
 <script>
     import { mapGetters, mapActions } from 'vuex'
     import { Searcher, CardGrid } from '@@/common'
+    import SupplierDetails from '@@/fromsSupplier/SupplierDetails'
     import { FILTER_PAYMENTS_PURCHASES_SUPPLIER, SELECT_PAYMENTS_PURCHASES_SUPPLIER } from '@/constants/actionTypes'
 
     export default {
         components: {
             Searcher,
-            CardGrid
+            CardGrid,
+            SupplierDetails
         },
         computed: mapGetters([
             'supplier',
             'supplierVisible',
-            'loadingSupplier'
+            'loadingSupplier',
+            'selectedSupplier'
         ]),
         methods: mapActions([
             FILTER_PAYMENTS_PURCHASES_SUPPLIER,

+ 11 - 0
src/constants/actionTypes.js

@@ -18,6 +18,13 @@ const INIT_PAYMENTS_PURCHASES_USER = 'initPaymentsPurchasesUser'
 const INIT_PAYMENTS_PURCHASES_SUPPLIER = 'initPaymentsPurchasesSupplier'
 const SELECT_PAYMENTS_PURCHASES_SUPPLIER = 'selectPaymentsPurchasesSupplier'
 const FILTER_PAYMENTS_PURCHASES_SUPPLIER = 'filterPaymentsPurchasesSupplier'
+/* invoice*/
+const INIT_SUPPLIER_INVOICES = 'initSupplierInvoices'
+const FILTER_SUPPLIER_INVOICES = 'filterSupplierInvoices'
+const SELECT_SUPPLIER_INVOICES = 'selectSupplierInvoices'
+/* Move Lines*/
+const INIT_SUPPLIER_MOVE_LINES = 'initSupplierMoveLines'
+const SELECT_SUPPLIER_MOVE_LINES = 'selectSuppierMoveLines'
 /**
  * [ Journal]
  */
@@ -40,6 +47,10 @@ export {
     INIT_PAYMENTS_PURCHASES_SUPPLIER,
     FILTER_PAYMENTS_PURCHASES_SUPPLIER,
     SELECT_PAYMENTS_PURCHASES_SUPPLIER,
+    //Invoices
+    INIT_SUPPLIER_INVOICES, FILTER_SUPPLIER_INVOICES, SELECT_SUPPLIER_INVOICES,
+    // Move Lines
+    INIT_SUPPLIER_MOVE_LINES, SELECT_SUPPLIER_MOVE_LINES,
     //JOURNAL
     INIT_PAYMENTS_PURCHASES_JOURNALS,
     //CURRENCIES

+ 12 - 0
src/constants/mutationTypes.js

@@ -15,6 +15,14 @@ const SET_SUPPLIER = 'setSupplier'
 const SET_LOADING_SUPPLIER = 'setLoadingSupplier'
 const SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER = 'setSelectedPaymentsPurchasesSupplier'
 const SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER = 'setFilterPaymentsPurchasesSupplier'
+/* Invoice */
+const SET_SUPPLIER_INVOICES = 'setSupplierInvoices'
+const SET_SELECTED_SUPPLIER_INVOICES = 'setSelectedSuppierInvoices'
+const SET_FILTER_SUPPLIER_INVOICES = 'setFilterSupplierInvoices'
+/* Move Lines */
+const SET_SUPPLIER_MOVE_LINES = 'setSupplierMoveLines'
+const SET_SELECTED_SUPPLIER_MOVE_LINES = 'setSelectedSupplierMoveLines'
+const SET_SUPPLIER_LINES_PAYMENTS = 'setSupplierLinesPayments'
 /**
  * [ Journal]
  */
@@ -36,6 +44,10 @@ export {
     SET_LOADING_USER,
     //SUPPLIER
     SET_SUPPLIER, SET_LOADING_SUPPLIER, SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER, SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER,
+    //Invoices
+    SET_SUPPLIER_INVOICES, SET_SELECTED_SUPPLIER_INVOICES, SET_FILTER_SUPPLIER_INVOICES,
+    // Move lines
+    SET_SUPPLIER_MOVE_LINES, SET_SELECTED_SUPPLIER_MOVE_LINES, SET_SUPPLIER_LINES_PAYMENTS,
     //JOURNALS
     SET_JOURNALS, SET_LOADING_JOURNALS,
     //CURRENCIES

+ 5 - 1
src/store/index.js

@@ -16,6 +16,8 @@ import paymentsPurchasesUser from '@/store/modules/PaymentsPurchasesUser'
 import paymentsPurchasesSupplier from '@/store/modules/PaymentsPurchasesSupplier'
 import paymentsPurchasesJournals from '@/store/modules/PaymentsPurchasesJournals'
 import paymentsPurchasesCurrencies from '@/store/modules/PaymentsPurchasesCurrencies'
+import supplierInvoices from '@/store/modules/SupplierInvoices'
+import SupplierMoveLines from '@/store/modules/SupplierMoveLines'
 
 
 Vue.use(Vuex)
@@ -27,7 +29,9 @@ const store = new Vuex.Store({
         paymentsPurchasesUser,
         paymentsPurchasesSupplier,
         paymentsPurchasesJournals,
-        paymentsPurchasesCurrencies
+        paymentsPurchasesCurrencies,
+        supplierInvoices,
+        SupplierMoveLines
     }
 })
 

+ 7 - 7
src/store/modules/PaymentsPurchasesCurrencies.js

@@ -31,18 +31,18 @@ const getters = {
 }
 
 const mutations = {
-    [SET_CURRENCIES] ( state, paylod ){
-        state.currency = paylod
+    [SET_CURRENCIES] ( state, payload ){
+        state.currency = payload
     },
-    [SET_LOADING_CURRENCIES] ( state, paylod ) {
-        state.loadingCurrency = !!paylod
+    [SET_LOADING_CURRENCIES] ( state, payload ) {
+        state.loadingCurrency = !!payload
     }
 }
 
 const actions = {
-    [INIT_PAYMENTS_PURCHASES_CURRENCIES] ({ commit }, paylod) {
-        commit(SET_CURRENCIES, paylod)
-        commit(SET_LOADING_CURRENCIES, paylod)
+    [INIT_PAYMENTS_PURCHASES_CURRENCIES] ({ commit }, payload) {
+        commit(SET_CURRENCIES, payload)
+        commit(SET_LOADING_CURRENCIES, payload)
     }
 }
 

+ 7 - 7
src/store/modules/PaymentsPurchasesDate.js

@@ -35,15 +35,15 @@ const mutations = {
      * [date description]
      * @type {[type]}
      */
-    [SET_DATE] (state, paylod) {
-        state.date = paylod
+    [SET_DATE] (state, payload) {
+        state.date = payload
     },
     /**
      * [loadingDate description]
      * @type {[type]}
      */
-    [SET_LOADING_DATE] (state, paylod) {
-        state.loadingDate = !!paylod
+    [SET_LOADING_DATE] (state, payload) {
+        state.loadingDate = !!payload
     }
 }
 
@@ -51,9 +51,9 @@ const actions = {
     /**
      * [INIT_PAYMENTS_PURCHASES_DATE]
      */
-    [INIT_PAYMENTS_PURCHASES_DATE] ({ commit }, paylod) {
-        commit(SET_DATE, paylod)
-        commit(SET_LOADING_DATE, paylod)
+    [INIT_PAYMENTS_PURCHASES_DATE] ({ commit }, payload) {
+        commit(SET_DATE, payload)
+        commit(SET_LOADING_DATE, payload)
     }
 }
 

+ 7 - 7
src/store/modules/PaymentsPurchasesJournals.js

@@ -35,15 +35,15 @@ const mutations = {
      * [journals description]
      * @type {[type]}
      */
-    [SET_JOURNALS] (state, paylod ) {
-        state.journals = paylod
+    [SET_JOURNALS] (state, payload ) {
+        state.journals = payload
     },
     /**
      * [loadingJournals description]
      * @type {[type]}
      */
-    [SET_LOADING_JOURNALS] (state, paylod) {
-        state.loadingJournals = !!paylod
+    [SET_LOADING_JOURNALS] (state, payload) {
+        state.loadingJournals = !!payload
     }
 }
 
@@ -51,9 +51,9 @@ const mutations = {
      /**
       * [INIT_PAYMENTS_PURCHASES_JOURNALS]
       */
-     [INIT_PAYMENTS_PURCHASES_JOURNALS] ({ commit }, paylod) {
-         commit(SET_JOURNALS, paylod)
-         commit(SET_LOADING_JOURNALS, paylod)
+     [INIT_PAYMENTS_PURCHASES_JOURNALS] ({ commit }, payload) {
+         commit(SET_JOURNALS, payload)
+         commit(SET_LOADING_JOURNALS, payload)
      }
  }
 

+ 19 - 17
src/store/modules/PaymentsPurchasesSupplier.js

@@ -2,8 +2,8 @@
 import {
     INIT_PAYMENTS_PURCHASES_SUPPLIER,
     FILTER_PAYMENTS_PURCHASES_SUPPLIER,
-    SELECT_PAYMENTS_PURCHASES_SUPPLIER
-
+    SELECT_PAYMENTS_PURCHASES_SUPPLIER,
+    INIT_SUPPLIER_INVOICES
 } from '@/constants/actionTypes'
 // Mutations
 import {
@@ -67,29 +67,29 @@ const mutations = {
      * [supplier description]
      * @type {[type]}
      */
-    [SET_SUPPLIER] (state, paylod) {
-        state.supplier = paylod
+    [SET_SUPPLIER] (state, payload) {
+        state.supplier = payload
     },
     /**
      * [loadingSupplier description]
      * @type {[type]}
      */
-    [SET_LOADING_SUPPLIER] (state, paylod) {
-        state.loadingSupplier = paylod
+    [SET_LOADING_SUPPLIER] (state, payload) {
+        state.loadingSupplier = payload
     },
     /**
      * [filterSupplier description]
      * @type {[type]}
      */
-    [SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER] (state, paylod) {
-        state.filterSupplier = paylod
+    [SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER] (state, payload) {
+        state.filterSupplier = payload
     },
     /**
      * [selectedSupplier description]
      * @type {[type]}
      */
-    [SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER] ( state, paylod ) {
-        state.selectedSupplier = paylod
+    [SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER] ( state, payload ) {
+        state.selectedSupplier = payload
     }
 }
 
@@ -97,21 +97,23 @@ const actions = {
     /**
      * [INIT_PAYMENTS_PURCHASES_SUPPLIER]
      */
-    [INIT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit },paylod) {
-        commit(SET_SUPPLIER, paylod)
-        commit(SET_LOADING_SUPPLIER, paylod)
+    [INIT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit },payload) {
+        commit(SET_SUPPLIER, payload)
+        commit(SET_LOADING_SUPPLIER, payload)
     },
     /**
      * [ FILTER_PAYMENTS_PURCHASES_SUPPLIER ]
      */
-    [FILTER_PAYMENTS_PURCHASES_SUPPLIER] ({ commit }, paylod) {
-        commit(SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER, paylod)
+    [FILTER_PAYMENTS_PURCHASES_SUPPLIER] ({ commit }, payload) {
+        commit(SET_FILTER_PAYMENTS_PURCHASES_SUPPLIER, payload)
     },
     /**
      * [SELECT_PAYMENTS_PURCHASES_SUPPLIER]
      */
-    [SELECT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit }, paylod) {
-        commit(SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER, paylod)
+    [SELECT_PAYMENTS_PURCHASES_SUPPLIER] ({ commit, dispatch }, payload) {
+        commit(SET_SELECTED_PAYMENTS_PURCHASES_SUPPLIER, payload)
+
+        dispatch(INIT_SUPPLIER_INVOICES, payload.invoices)
     }
 }
 

+ 7 - 7
src/store/modules/PaymentsPurchasesUser.js

@@ -35,22 +35,22 @@ const mutations = {
      * [user description]
      * @type {[type]}
      */
-    [SET_USER] (state, paylod) {
-        state.user = paylod
+    [SET_USER] (state, payload) {
+        state.user = payload
     },
     /**
      * [loadingUser description]
      * @type {[type]}
      */
-    [SET_LOADING_USER] (state, paylod) {
-        state.loadingUser = !!paylod
+    [SET_LOADING_USER] (state, payload) {
+        state.loadingUser = !!payload
     }
 }
 
 const actions = {
-    [INIT_PAYMENTS_PURCHASES_USER] ({ commit }, paylod) {
-        commit(SET_USER, paylod)
-        commit(SET_LOADING_USER, paylod)
+    [INIT_PAYMENTS_PURCHASES_USER] ({ commit }, payload) {
+        commit(SET_USER, payload)
+        commit(SET_LOADING_USER, payload)
     }
 }
 

+ 102 - 0
src/store/modules/SupplierInvoices.js

@@ -0,0 +1,102 @@
+/* Actions */
+import {
+    INIT_SUPPLIER_INVOICES,
+    FILTER_SUPPLIER_INVOICES,
+    SELECT_SUPPLIER_INVOICES,
+    INIT_SUPPLIER_MOVE_LINES
+} from '@/constants/actionTypes'
+/* Mutations */
+import {
+    SET_SUPPLIER_INVOICES,
+    SET_SELECTED_SUPPLIER_INVOICES,
+    SET_FILTER_SUPPLIER_INVOICES,
+} from '@/constants/mutationTypes'
+
+const initialState = {
+    supplierInvoices: [],
+    filterInvoices: [],
+    selectedInvoices: null
+}
+const state = {
+    supplierInvoices: initialState.supplierInvoices,
+    filterInvoices: initialState.filterInvoices,
+    selectedInvoices: initialState.selectedInvoices
+}
+const getters = {
+    /**
+     * [supplierInvoices description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    supplierInvoices (state) {
+        return state.supplierInvoices
+    },
+    /**
+     * [filterInvoices description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    supplierInvoicesVisibles ( state ) {
+        return state.filterInvoices.length ===0 ? state.supplierInvoices :  state.filterInvoices
+    },
+    /**
+     * [selectedInvoices description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    selectedInvoices ( state ) {
+        return state.selectedInvoices
+    }
+}
+const mutations = {
+    /**
+     * [Invoices description]
+     * @type {[type]}
+     */
+    [SET_SUPPLIER_INVOICES] (state, payload ) {
+            state.supplierInvoices = payload
+    },
+    /**
+     * [selectedInvoices description]
+     * @type {[type]}
+     */
+    [SET_SELECTED_SUPPLIER_INVOICES] ( state, payload ) {
+        state.selectedInvoices= payload
+    },
+    /**
+     * [filterInvoices description]
+     * @type {[type]}
+     */
+    [SET_FILTER_SUPPLIER_INVOICES] ( state, payload ) {
+        state.filterInvoices = payload
+    }
+}
+const actions = {
+    /**
+     * [INIT_SUPPLIER_INVOICES]
+     */
+    [INIT_SUPPLIER_INVOICES] ({ commit }, payload ) {
+        commit(SET_SUPPLIER_INVOICES, payload)
+    },
+    /**
+     * [FILTER_SUPPLIER_INVOICES]
+     */
+    [FILTER_SUPPLIER_INVOICES] ({ commit }, payload ) {
+        commit(SET_FILTER_SUPPLIER_INVOICES, payload)
+    },
+    /**
+     * [SELECT_SUPPLIER_INVOICES]
+     */
+    [SELECT_SUPPLIER_INVOICES] ({commit, dispatch}, payload) {
+        commit(SET_SELECTED_SUPPLIER_INVOICES, payload)
+
+        dispatch(INIT_SUPPLIER_MOVE_LINES, payload.moveLines)
+    }
+}
+
+export default {
+    state,
+    getters,
+    mutations,
+    actions
+}

+ 96 - 0
src/store/modules/SupplierMoveLines.js

@@ -0,0 +1,96 @@
+/* Actions */
+import {
+    INIT_SUPPLIER_MOVE_LINES,
+    SELECT_SUPPLIER_MOVE_LINES
+} from '@/constants/actionTypes'
+/* Mutations */
+import {
+    SET_SUPPLIER_MOVE_LINES,
+    SET_SELECTED_SUPPLIER_MOVE_LINES,
+    SET_SUPPLIER_LINES_PAYMENTS
+} from '@/constants/mutationTypes'
+
+const intialState = {
+    supplierMoveLines: [],
+    selectdLines: [],
+    supplierLinesPayments: [],
+    supplierPaymentsTotal: 0
+}
+const  state = {
+    supplierMoveLines: intialState.supplierMoveLines,
+    selectdLines: intialState.selectdLines,
+    supplierLinesPayments: intialState.supplierLinesPayments,
+    supplierPaymentsTotal: intialState.supplierPaymentsTotal
+}
+const getters = {
+    /**
+     * [supplierMoveLines description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    supplierMoveLines ( state ) {
+        return state.supplierMoveLines
+    },
+    /**
+     * [selectdLines description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    selectdLines ( state ){
+        return state.selectdLines
+    },
+    /**
+     * [supplierLinesPayments description]
+     * @param  {[type]} state [description]
+     * @return {[type]}       [description]
+     */
+    supplierLinesPayments ( state ) {
+        return state.supplierLinesPayments
+    },
+    supplierPaymentsTotal ( state ) {
+        return state.supplierPaymentsTotal
+    }
+}
+const mutations = {
+    /**
+     * [supplierInvoices description]
+     * @type {[type]}
+     */
+    [SET_SUPPLIER_MOVE_LINES] (state, payload) {
+        state.supplierMoveLines = payload
+    },
+    /**
+     * [selectdLines description]
+     * @type {[type]}
+     */
+    [SET_SELECTED_SUPPLIER_MOVE_LINES] ( state, payload) {
+        state.selectdLines = payload
+    },
+
+    [SET_SUPPLIER_LINES_PAYMENTS] (state, payload) {
+        state.supplierLinesPayments = [payload, ...state.supplierLinesPayments]
+    }
+
+}
+const actions = {
+    /**
+     * [INIT_SUPPLIER_MOVE_LINES]
+     */
+    [INIT_SUPPLIER_MOVE_LINES] ({ commit }, payload) {
+        commit(SET_SUPPLIER_MOVE_LINES, payload)
+    },
+    /**
+     *  [SELECT_SUPPLIER_MOVE_LINES]
+     */
+    [SELECT_SUPPLIER_MOVE_LINES] ({ commit }, payload) {
+        commit(SET_SELECTED_SUPPLIER_MOVE_LINES, payload)
+        commit(SET_SUPPLIER_LINES_PAYMENTS, payload)
+    }
+}
+
+export default {
+    state,
+    getters,
+    mutations,
+    actions
+}