Exemplo n.º 1
0
        public VE_BankAccount BankAdjustment(VE_Invoice vE_Invoice)
        {
            vE_Invoice.invoiceDetail = new List <VE_InvoiceDetail>();
            if (vE_Invoice.amountTotal < 0)
            {
                vE_Invoice.amountTotal = vE_Invoice.amountTotal * -1;
                vE_Invoice.invoiceType = "O";
            }
            else
            {
                vE_Invoice.invoiceType = "S";
            }
            BL_Invoice bL_Invoice = new BL_Invoice();

            bL_Invoice.connectionString = connectionString;
            var invoice = bL_Invoice.CreateInvoice(vE_Invoice);

            _database = new MySQLDatabase(connectionString);
            return(new DA_Bank(_database).updateBalanceBankAccountByInvoice(int.Parse(invoice.invoiceId), invoice.bankAccountId));
        }
Exemplo n.º 2
0
        public bool NextWorkFlowStep(ref string mensaje, int workFlowId, int IdInvoice, string userName, bool refuse, string comment)
        {
            try
            {
                _database = new MySQLDatabase(connectionString);
                var result = new DA_WorkFlow(_database).NextWorkFlowStep(ref mensaje, workFlowId, IdInvoice, userName, refuse);

                if (!string.IsNullOrEmpty(comment) && refuse)
                {
                    BEInvoiceFilter filter = new BEInvoiceFilter();
                    filter.invoiceIdList = IdInvoice.ToString();
                    filter.statusList    = "";
                    filter.invoiceType   = "";

                    BL_Invoice bL_Invoice = new BL_Invoice();
                    bL_Invoice.connectionString = connectionString;
                    var invoice = bL_Invoice.GetInvoiceGeneral(filter);
                    if (invoice.Count > 0)
                    {
                        invoice[0].userName  = userName;
                        invoice[0].comments += comment;
                        bL_Invoice.updateInvoiceGeneral(invoice[0]);
                    }
                    else
                    {
                        mensaje = "No existe una factura que concuerde con la informacion proporcionada";
                    }
                }


                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }