Esempio n. 1
0
        public CheckNotebook(Cheque.BL.CheckClass check)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();
            notebook1.PrevPage ();
            checkinfo.UpdateInfo (check);

            checkinfo.ChangedCheck += (object sender, EventArgs e) => {
                customerinfo1.customer = DAL.DataManager.GetCustomer (check.CustomerID);
                customerinfo1.UpdateInfo ();
                customerinfo1.ShowAll ();

                branchinfo1.Branch = DAL.DataManager.GetBranch (check.BranchNumber, check.BankNumber);
                branchinfo1.UpdateInfo ();
                branchinfo1.ShowAll ();
            };

            checkinfo.ShowAll ();

            customerinfo1.customer = DAL.DataManager.GetCustomer (check.CustomerID);
            customerinfo1.UpdateInfo ();
            customerinfo1.ShowAll ();

            branchinfo1.Bank = DAL.DataManager.GetBank (check.BankNumber);
            branchinfo1.Branch = DAL.DataManager.GetBranch (check.BranchNumber, check.BankNumber);
            branchinfo1.UpdateInfo ();
            branchinfo1.ShowAll ();
        }
        public void Alterar(Cheque cheque)
        {
            try
            {
                Cheque chequeAux = new Cheque();
                chequeAux.ID = cheque.ID;

                List<Cheque> resultado = this.Consultar(chequeAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new ChequeNaoAlteradoExcecao();

                chequeAux.Agencia = cheque.Agencia;
                chequeAux.Banco = cheque.Banco;
                chequeAux.Conta = cheque.Conta;
                chequeAux.Cpf = cheque.Cpf;
                chequeAux.NumCheque = cheque.NumCheque;
                chequeAux.Parcela = cheque.Parcela;
                chequeAux.Status = cheque.Status;
                chequeAux.Tipo = cheque.Tipo;
                chequeAux.Valor = cheque.Valor;

                chequeAux = resultado[0];

                Confirmar();
            }
            catch (Exception)
            {

                throw new ChequeNaoAlteradoExcecao();
            }
        }
Esempio n. 3
0
        private void Valider_Click(object sender, RoutedEventArgs e)
        {
            double som;
            string s    = somme.Text.ToString();
            string cinC = cinClient.Text.ToString();
            string numC = numCheque.Text.ToString();

            if (somme.Text.ToString() == "" || numCheque.Text.ToString() == "" || nomClient.Text.ToString() == "" || cinClient.Text.ToString() == "")
            {
                MessageBox.Show("Les champs sant obligatoire !");
            }
            else if (!double.TryParse(s, out som))
            {
                MessageBox.Show("Montant doit etre un reel !");
            }

            else if (!double.TryParse(cinC, out som))
            {
                MessageBox.Show("CIN doit etre un entier !");
            }
            else if (!double.TryParse(numC, out som))
            {
                MessageBox.Show("Numéro du compte doit etre un entier !");
            }
            else if (nomClient.Text == "")
            {
                MessageBox.Show("Nom et prénom incorect !");
            }
            decimal sum;

            decimal.TryParse(somme.Text, out sum);
            if (prix == sum)
            {
                TK_et_FK tk = new TK_et_FK(com);


                tk.ShowDialog();
                CommandeDAO daoc = new CommandeDAO();
                daoc.updateEtat(com);
                decimal   some;
                DateTime  d;
                ChequeDAO daoch = new ChequeDAO();
                DateTime.TryParse(dateCheque.Text, out d);
                Decimal.TryParse(somme.Text, out some);
                int    lastch = daoch.getLastCheque() + 1;
                Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text);
                daoch.add(cheque);
                Payement    pa   = new Payement(1, lastch, com, sum);
                PayementDAO daop = new PayementDAO();
                daop.addPaycheque(pa);
                g.PerformRefresh();
                TableDAO table = new TableDAO();
                Commande c     = daoc.getById(com);
                table.update(c.NumTable, false);
                this.Close();
                p.Close();
            }
            else
            {
                decimal res = prix - sum;
                this.p.txtEspece.Text   = "" + res;
                this.p.lbltotal.Content = "" + res;
                decimal   some;
                DateTime  d;
                ChequeDAO daoch = new ChequeDAO();
                DateTime.TryParse(dateCheque.Text, out d);
                Decimal.TryParse(somme.Text, out some);
                int    lastch = daoch.getLastCheque() + 1;
                Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text);
                daoch.add(cheque);
                Payement    pa   = new Payement(1, lastch, com, sum);
                PayementDAO daop = new PayementDAO();
                daop.addPaycheque(pa);
                g.PerformRefresh();

                this.Close();
            }
        }
Esempio n. 4
0
        public ActionResult pagoEnvio2(Pago model, string clienteR, MetodoPago e, Cheque ch, Transferencia trans, Tarjeta tarj)
        {
            //DAOPago data = DAOPago.getInstance();
            //data.insertarPago(model2.monto, model.fecha, pagoD, model2.cod);
            int    fkCliente   = Int32.Parse(clienteR);
            int    pagoTotal   = e.montoE + ch.montoCh + trans.montoTrans + tarj.montoTarj;
            int    montoTotal  = model.montoTotal;
            string metodoPago  = TempData["metodo1"].ToString();
            string metodoPago2 = TempData["metodo2"].ToString();
            string metodoPago3 = TempData["metodo3"].ToString();
            string metodoPago4 = TempData["metodo4"].ToString();

            if (pagoTotal == montoTotal)
            {
                DAOPago data2 = DAOPago.getInstance();
                Pago    pago  = data2.buscarUltimoPago();
                if ((metodoPago == "efectivo") || (metodoPago2 == "efectivo") || (metodoPago3 == "efectivo") || (metodoPago4 == "efectivo"))
                {
                    DAOEfectivo dataE = DAOEfectivo.getInstance();
                    dataE.insertarEfectivo(pago.cod, e.moneda, fkCliente);
                }
                if ((metodoPago == "cheque") || (metodoPago2 == "cheque") || (metodoPago3 == "cheque") || (metodoPago4 == "cheque"))
                {
                    DAOCheque dataCh = DAOCheque.getInstance();
                    dataCh.insertarCheque(pago.cod, ch.Banco, ch.NroCuenta, ch.fecha, ch.montoCh, fkCliente);
                }
                if ((metodoPago == "transferencia") || (metodoPago2 == "transferencia") || (metodoPago3 == "transferencia") || (metodoPago4 == "transferencia"))
                {
                    DAOTransferencia dataTrans = DAOTransferencia.getInstance();
                    dataTrans.insertarTransferencia(pago.cod, trans.Banco, trans.NroCuenta, trans.descripcion, trans.correo, fkCliente);
                }
                if ((metodoPago == "tarjeta") || (metodoPago2 == "tarjeta") || (metodoPago3 == "tarjeta") || (metodoPago4 == "tarjeta"))
                {
                    DAOTarjeta dataTarj = DAOTarjeta.getInstance();
                    dataTarj.insertarTarjeta(pago.cod, tarj.Banco, tarj.NroCuenta, tarj.tipo, tarj.fechaVencimiento, tarj.marca, fkCliente);
                }

                DAOEnvio     data   = DAOEnvio.getInstance();
                List <Envio> envios = data.obtenerEnvio();
                foreach (var item in envios)
                {
                    data2        = DAOPago.getInstance();
                    pago         = data2.buscarPagoEnvio(item.cod);
                    item.codPago = pago.cod;
                }
                return(View("~/Views/EnviarPaquete/IndexEnvio.cshtml", envios));
            }
            else
            {
                DAOPago data2 = DAOPago.getInstance();
                Pago    pago  = data2.buscarUltimoPago();

                //DAOEfectivo dataE = DAOEfectivo.getInstance();
                //dataE.insertarEfectivo(pago.cod, e.moneda, c.CI);
                //DAOCheque dataCh = DAOCheque.getInstance();
                //dataCh.insertarCheque(pago.cod, ch.Banco, ch.NroCuenta, ch.fecha, ch.montoCh, c.CI);
                //DAOTransferencia dataTrans = DAOTransferencia.getInstance();
                //dataTrans.insertarTransferencia(pago.cod, trans.Banco, trans.NroCuenta, trans.descripcion, trans.correo, c.CI);
                //DAOTarjeta dataTarj = DAOTarjeta.getInstance();
                //dataTarj.insertarTarjeta(pago.cod, tarj.Banco, tarj.NroCuenta, tarj.tipo, tarj.fechaVencimiento, tarj.marca, c.CI);

                ViewBag.mP    = metodoPago;
                ViewBag.mP2   = metodoPago2;
                ViewBag.mP3   = metodoPago3;
                ViewBag.mP4   = metodoPago4;
                ViewBag.Error = "LA SUMA DE LOS PAGOS NO ES SUFICIENTE";
                return(View("~/Views/Pago/PagoEnvio2.cshtml", pago));
            }
        }
Esempio n. 5
0
        public async Task <HttpResponseMessage> LoadReceiveAndPay([FromBody] int id)
        {
            var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId);

            FinanYearRule finanYearRule = new FinanYearRule();
            var           finanYerar    = await finanYearRule.GetCurrentFinanYear(organId);

            var payRecevie = await Rule.FindAsync(id);

            ReceiveAndPayVM receiveAndPayVM = new ReceiveAndPayVM();



            //var account = await accountRule.FindAsync((int)payRecevie.AccountId);
            //receiveAndPayVM.Account = account;
            receiveAndPayVM.Amount      = payRecevie.Amount;
            receiveAndPayVM.Contact     = payRecevie.Contact;
            receiveAndPayVM.Description = payRecevie.Description;
            //receiveAndPayVM.DetailAccount = payRecevie.de
            receiveAndPayVM.DisplayDate = payRecevie.DisplayDate;
            receiveAndPayVM.Id          = payRecevie.ID;
            receiveAndPayVM.Invoice     = payRecevie.Invoice;
            receiveAndPayVM.Items       = payRecevie.Items.ToList();
            receiveAndPayVM.Number      = payRecevie.Document.Number;
            receiveAndPayVM.Number2     = payRecevie.Document.Number2;
            //receiveAndPayVM.PayItems = payRecevie.pa
            receiveAndPayVM.Type = payRecevie.Type;
            if (payRecevie.Contact != null)
            {
                payRecevie.ContactId = payRecevie.Contact.ID;
            }
            if (payRecevie.Invoice != null)
            {
                payRecevie.InvoiceId = payRecevie.Invoice.ID;
            }


            decimal amount = 0;

            foreach (var item in payRecevie.Items)
            {
                amount += item.Amount;

                if (item.CashId > 0)
                {
                    CashRule cashRule = new CashRule();
                    item.Cash = await cashRule.FindAsync((int)item.CashId);
                }
                else if (item.Bank != null)
                {
                    item.BankId = item.Bank.ID;
                }
                else if (item.Cheque != null)
                {
                    Cheque cheque = new Cheque()
                    {
                        Amount       = item.Amount,
                        BankBranch   = item.Cheque.BankBranch,
                        BankName     = item.Cheque.BankName,
                        ChequeNumber = item.Cheque.ChequeNumber,
                        Contact      = payRecevie.Contact,
                        ContactId    = payRecevie.Contact.ID,
                        Date         = DateTime.Now,// item.Cheque.Date,
                        OrganId      = organId,
                        Status       = ZhivarEnums.ChequeStatus.Normal,
                        DisplayDate  = item.Cheque.DisplayDate,
                        Type         = ZhivarEnums.ChequeType.Pardakhtani,
                        ReceiptDate  = DateTime.Now,
                    };
                    item.Cheque   = cheque;
                    item.ChequeId = item.Cheque.ID;
                }
            }

            payRecevie.Amount = amount;

            if (payRecevie.Contact != null)
            {
                var account1104 = await CalcAccountByCodeTafziliAsync(organId, "1104" + payRecevie.Contact.Code);

                var account1105 = await CalcAccountByCodeTafziliAsync(organId, "1105" + payRecevie.Contact.Code);

                var account2101 = await CalcAccountByCodeTafziliAsync(organId, "2101" + payRecevie.Contact.Code);


                payRecevie.Contact.Balance   = account1104.sumTotal + account1105.sumTotal + account2101.sumTotal - amount;
                payRecevie.Contact.Credits   = account1104.sumCredit + account1105.sumCredit + account2101.sumCredit - amount;
                payRecevie.Contact.Liability = account1104.sumDebit + account1105.sumDebit + account2101.sumDebit;
            }


            //if (payRecevie.Invoice != null)
            //{
            //    if (payRecevie.Invoice.Contact != null)
            //        payRecevie.Invoice.ContactId = payRecevie.Invoice.Contact.ID;

            //    //payRecevie.Invoice.FinanYear = finanYerar;
            //    //payRecevie.Invoice.FinanYearId = finanYerar.ID;
            //    var invoice = payRecevie.Invoice;
            //    invoice.Rest -= amount;
            //    invoice.Paid += amount;
            //    invoiceRule.Update(invoice);
            //}


            return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = payRecevie }));
        }
Esempio n. 6
0
 ///<inheritdoc cref="IChequeService"/>
 public async Task <Cheque> SaveCheque(Cheque cheque)
 {
     Log.Info("Received a request to save the receipt");
     return(await Repository.Insert(cheque));
 }
Esempio n. 7
0
 public abstract void Sustar(Cheque cheque, DateTime dataEvento, string motivo);
Esempio n. 8
0
 public override void Compensar(Cheque cheque, DateTime dataEvento)
 {
     cheque.MudarEstado(new ChequeCompensado(dataEvento));
 }
Esempio n. 9
0
        public ClientResponse listarReporte(int CampaniaID, int ProductoID, int InstitucionEducativaID, DateTime?FechaInicial, DateTime?FechaFinal, int paginaActual, int RegistroXPagina)
        {
            int recordCount = 0;

            try
            {
                using (conexion = new SqlConnection(ConexionDAO.cnx))
                {
                    using (comando = new SqlCommand("usp_cheque_getLst", conexion))
                    {
                        comando.CommandType = CommandType.StoredProcedure;
                        comando.Parameters.AddWithValue("@CampaniaID", CampaniaID);
                        comando.Parameters.AddWithValue("@ProductoID", ProductoID);
                        comando.Parameters.AddWithValue("@InstitucionEducativaID", InstitucionEducativaID);
                        comando.Parameters.AddWithValue("@StartDate", FechaInicial);
                        comando.Parameters.AddWithValue("@EndDate", FechaFinal);
                        comando.Parameters.AddWithValue("@vi_Pagina", paginaActual);
                        comando.Parameters.AddWithValue("@vi_RegistrosporPagina", RegistroXPagina);
                        comando.Parameters.Add("@vi_RecordCount", SqlDbType.Int).Direction = ParameterDirection.Output;
                        conexion.Open();
                        using (reader = comando.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                entidad = new Cheque();

                                entidad.ID         = (reader["ID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["ID"].ToString());
                                entidad.CampaniaID = (reader["CampaniaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["CampaniaID"]);

                                Campania oCamp = new Campania();
                                oCamp.Nombre     = (reader["CampaniaNm"] == DBNull.Value) ? "" : reader["CampaniaNm"].ToString();
                                entidad.Campania = oCamp;
                                entidad.InstitucionEducativaID = (reader["InstitucionEducativaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["InstitucionEducativaID"]);

                                InstitucionEducativa oInst = new InstitucionEducativa();
                                oInst.Nombre = (reader["InstitucionEducativaNm"] == DBNull.Value) ? "" : reader["InstitucionEducativaNm"].ToString();
                                entidad.InstitucionEducativa = oInst;

                                entidad.CIASeguroID = (reader["CIASeguroID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["CIASeguroID"]);

                                CIASeguro oCia = new CIASeguro();
                                oCia.Nombre       = (reader["CIASeguroNm"] == DBNull.Value) ? "" : reader["CIASeguroNm"].ToString();
                                entidad.CIASeguro = oCia;

                                entidad.ProductoID = (reader["ProductoID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["ProductoID"]);

                                Producto oProd = new Producto();
                                oProd.Nombre     = (reader["ProductoNm"] == DBNull.Value) ? "" : reader["ProductoNm"].ToString();
                                entidad.Producto = oProd;

                                entidad.BancoID = (reader["BancoID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["BancoID"]);

                                Banco oBan = new Banco();
                                oBan.Nombre   = (reader["BancoNm"] == DBNull.Value) ? "" : reader["BancoNm"].ToString();
                                entidad.Banco = oBan;

                                entidad.MonedaID = (reader["MonedaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["MonedaID"]);

                                Moneda oMon = new Moneda();
                                oMon.Nombre    = (reader["MonedaNm"] == DBNull.Value) ? "" : reader["MonedaNm"].ToString();
                                entidad.Moneda = oMon;

                                entidad.Fecha     = Convert.ToDateTime(reader["Fecha"]);
                                entidad.NroCheque = (reader["NroCheque"] == DBNull.Value) ? "" : reader["NroCheque"].ToString();
                                entidad.Monto     = (reader["Monto"] == DBNull.Value) ? 0 : Convert.ToDecimal(reader["Monto"]);
                                entidad.Concepto  = (reader["Concepto"] == DBNull.Value) ? "" : reader["Concepto"].ToString();

                                lstCheque.Add(entidad);
                            }
                        }
                        recordCount = Convert.ToInt32(comando.Parameters["@vi_RecordCount"].Value);
                    }
                }
            }
            catch (Exception ex)
            {
                clientResponse.Mensaje = ex.Message;
                clientResponse.Status  = "ERROR";
            }
            finally
            {
                conexion.Close();
                conexion.Dispose();
                comando.Dispose();
                reader.Dispose();
            }
            Pagination responsepaginacion = new Pagination()
            {
                TotalItems = recordCount,
                TotalPages = (int)Math.Ceiling((double)recordCount / 10)
                             //TotalPages = (int)Math.Ceiling((double)recordCount / objeto.ItemsPerPage)
            };

            clientResponse.DataJson   = JsonConvert.SerializeObject(lstCheque).ToString();
            clientResponse.paginacion = JsonConvert.SerializeObject(responsepaginacion).ToString();
            return(clientResponse);
        }
        private void CreateChequeStatus(Cheque cheque, ChequeModel model, DateTime today)
        {
            ChequeStatu chequeStatus = new ChequeStatu();
            chequeStatus.Cheque = cheque;
            chequeStatus.ChequeStatusType = ChequeStatusType.ReceivedType;
            chequeStatus.Remarks = model.Remarks;
            chequeStatus.TransitionDateTime = today;
            chequeStatus.IsActive = true;

            Context.ChequeStatus.AddObject(chequeStatus);
        }
        private void ChequeModelPrepareForSave(FinancialAccount financialAccount, PartyRole customerPartyRole, int employeePartyRoleId, DateTime today, ChequeModel model)
        {
            if (model.IsNew)
            {
                var application = financialAccount.Agreement.Application;
                var loanAccount = financialAccount.LoanAccount;

                //new payment
                Payment payment = CreatePayment(customerPartyRole, employeePartyRoleId, model, today);

                //new cheque
                Cheque newCheck = new Cheque();
                newCheck.BankPartyRoleId = model.BankId;
                newCheck.CheckDate = model.ChequeDate;
                newCheck.Payment = payment;

                //new cheque association
                ChequeApplicationAssoc chequeAssoc = new ChequeApplicationAssoc();
                chequeAssoc.Cheque = newCheck;
                chequeAssoc.Application = application;

                //new cheque loan association
                ChequeLoanAssoc chequeLoanAssoc = new ChequeLoanAssoc();
                chequeLoanAssoc.Cheque = newCheck;
                chequeLoanAssoc.LoanAccount = loanAccount;

                //new receipt
                Receipt newReceipt = CreateReceipt(customerPartyRole, payment, model);

                //new receipt payment assoc
                ReceiptPaymentAssoc newReceiptAssoc = CreateReceiptPaymentAssoc(payment, newReceipt);

                //new receipt status
                CreateReceiptStatus(newReceipt, model, today);

                //new cheque status
                CreateChequeStatus(newCheck, model, today);

                Context.Cheques.AddObject(newCheck);
            }
            else if (model.ToBeDeleted)
            {
                //throw new NotImplementedException();
                var payment = Context.Payments.SingleOrDefault(entity => entity.Id == model.PaymentId);
                var receiptPaymentAssoc = Context.ReceiptPaymentAssocs.SingleOrDefault(entity => entity.PaymentId == payment.Id);
                var receipts = receiptPaymentAssoc.Receipt;
                var cheque = Context.Cheques.SingleOrDefault(entity => entity.Id == model.ChequeId && entity.PaymentId == payment.Id);

                var assoc = Context.ChequeApplicationAssocs.SingleOrDefault(entity => entity.ChequeId == cheque.Id);

                Context.ReceiptPaymentAssocs.DeleteObject(receiptPaymentAssoc);
                Context.Receipts.DeleteObject(receipts);
                Context.ChequeApplicationAssocs.DeleteObject(assoc);
                Context.Cheques.DeleteObject(cheque);
                Context.Payments.DeleteObject(payment);
            }
        }
        private static ChequeStatu CreateCancelledChequeStatus(Cheque cheque, DateTime today)
        {
            ChequeStatu chequeStatus = new ChequeStatu();
            chequeStatus.Cheque = cheque;
            chequeStatus.ChequeStatusType = ChequeStatusType.CancelledType;
            chequeStatus.Remarks = "Cancelled due to loan restructure";
            chequeStatus.TransitionDateTime = today;
            chequeStatus.IsActive = true;

            Context.ChequeStatus.AddObject(chequeStatus);

            return chequeStatus;
        }
        public List<Cheque> Consultar(Cheque cheque, TipoPesquisa tipoPesquisa)
        {
            List<Cheque> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (cheque.ID != 0)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.ID == cheque.ID
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Agencia))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Agencia.Contains(cheque.Agencia)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Banco))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Banco.Contains(cheque.Banco)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Conta))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Conta.Contains(cheque.Conta)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Cpf))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Cpf.Contains(cheque.Cpf)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Tipo != 0)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Tipo == cheque.Tipo
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.NumCheque.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.NumCheque.HasValue && c.NumCheque.Value == cheque.NumCheque.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Status.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Status.HasValue && c.Status.Value == cheque.Status.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Valor.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Valor.HasValue && c.Valor.Value == cheque.Valor.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (cheque.ID != 0)
                        {
                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.ID == cheque.ID
                                                select c).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Agencia))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Agencia.Contains(cheque.Agencia)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Banco))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Banco.Contains(cheque.Banco)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Conta))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Conta.Contains(cheque.Conta)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Cpf))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Cpf.Contains(cheque.Cpf)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Tipo != 0)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Tipo == cheque.Tipo
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.NumCheque.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.NumCheque.HasValue && c.NumCheque.Value == cheque.NumCheque.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Status.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Status.HasValue && c.Status.Value == cheque.Status.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Valor.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Valor.HasValue && c.Valor.Value == cheque.Valor.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public void Incluir(Cheque cheque)
        {
            try
            {
                db.Cheque.InsertOnSubmit(cheque);
            }
            catch (Exception)
            {

                throw new ChequeNaoIncluidoExcecao();
            }
        }
Esempio n. 15
0
 public ReportParagraph(Cheque cheque)
 {
     _cheque = cheque;
 }
        public void PrepareForSave(LoanApplication loanApplication, PartyRole customerPartyRole, int employeePartyRole, DateTime today)
        {
            if (this.IsNew)
            {
                var assoc = Context.ChequeApplicationAssocs.Where(e => e.ApplicationId == loanApplication.ApplicationId);
                if (assoc != null)
                {
                    foreach (var item in assoc)
                    {
                        var cheque = Context.Cheques.SingleOrDefault(entity => entity.Id == item.ChequeId);
                        var payments = Payment.GetById(cheque.PaymentId);
                        var rpAssoc = Context.ReceiptPaymentAssocs.SingleOrDefault(entity => entity.PaymentId == payments.Id);
                        Receipt receipts = Context.Receipts.SingleOrDefault(entity => entity.Id == rpAssoc.ReceiptId);

                        Context.ChequeApplicationAssocs.DeleteObject(item);
                        Context.Cheques.DeleteObject(cheque);
                        Context.Receipts.DeleteObject(receipts);
                        Context.Payments.DeleteObject(payments);
                        Context.ReceiptPaymentAssocs.DeleteObject(rpAssoc);
                    }
                }

                //create Payment
                var transactionDate = DateTime.Today;
                Payment payment = Payment.CreatePayment(today, transactionDate, customerPartyRole.Id, employeePartyRole,
                    this.Amount, PaymentType.Receipt, PaymentMethodType.PersonalCheckType,
                    SpecificPaymentType.LoanPaymentType, this.ChequeNumber);
                Context.Payments.AddObject(payment);

                //create cheque
                Cheque newCheck = new Cheque();
                newCheck.BankPartyRoleId = this.BankId;
                newCheck.CheckDate = this.ChequeDate;
                newCheck.Payment = payment;
                Context.Cheques.AddObject(newCheck);

                //create cheque association
                ChequeApplicationAssoc chequeAssoc = new ChequeApplicationAssoc();
                chequeAssoc.Cheque = newCheck;
                chequeAssoc.Application = loanApplication.Application;

                //create receipt and receipt payment assoc
                Receipt receipt = Receipt.CreateReceipt(null, this.Amount);
                Receipt.CreateReceiptPaymentAssoc(receipt, payment);

                //Context.SaveChanges();
            }
            else if (this.ToBeDeleted)
            {
                var payment = Payment.GetById(this.PaymentId);
                //TODO:: Changed to new payment
                var cheque = Context.Cheques.SingleOrDefault(entity => entity.Id == this.ChequeId && entity.PaymentId == payment.Id);
                var rpAssoc = Context.ReceiptPaymentAssocs.SingleOrDefault(entity => entity.PaymentId == payment.Id);

                var assoc = Context.ChequeApplicationAssocs.SingleOrDefault(entity => entity.ChequeId == cheque.Id);
                //TODO:: Changed to new payment
                Context.ChequeApplicationAssocs.DeleteObject(assoc);
                Context.Cheques.DeleteObject(cheque);
                Context.Receipts.DeleteObject(rpAssoc.Receipt);
                Context.Payments.DeleteObject(rpAssoc.Payment);
                Context.ReceiptPaymentAssocs.DeleteObject(rpAssoc);
            }

            else if (this.IsNew == false && this.ToBeDeleted == false)
            {
                var payment = Context.Payments.SingleOrDefault(entity => entity.Id == this.PaymentId);
                payment.TransactionDate = this.TransactionDate;
                payment.PaymentReferenceNumber = this.ChequeNumber;

                var cheque = Context.Cheques.SingleOrDefault(entity => entity.Id == this.ChequeId && entity.PaymentId == payment.Id);
                cheque.BankPartyRoleId = this.BankId;
            }
        }
Esempio n. 17
0
 public void Actualizar(Cheque cheque)
 {
     _context.Cheque.Attach(cheque);
     _context.Entry(cheque).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public bool Put([FromBody] Cheque cheque)
 {
     return(_chequeRepository.UpdateCheque(cheque));
 }
        protected void add_Callback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            List <Payment> payments;

            if (e.Parameters == "clear")
            {
                Session["listPayment"] = null;
            }

            #region Add Payment

            else
            {
                payments = new List <Payment>();
                decimal amount = 0.0M, amountCheque = 0.0M, amountChequeForTransaction = 0.0M;
                if (cbxPayMethod.SelectedItem == null)
                {
                    throw new ApplicationException("เลือกวิธีการชำระเงิน");
                }
                String payMethod = (String)cbxPayMethod.SelectedItem.Value;
                String payType   = (cbxPayType.SelectedItem == null ? "Cash" : (String)cbxPayType.SelectedItem.Value);
                //Party payee = Organization.FindByCode(iSabayaContext, CommonConstants.PayeeOrgCode);
                Payment payment = null;

                #region BankDeposit

                if (payMethod.Equals("BankAccountDeposit"))
                {
                    BankDeposit bankDeposit = new BankDeposit();
                    bankDeposit.PaymentType = "BankDeposit";
                    if (payType.Equals("Cash"))
                    {
                        amount                  = (decimal)spnAmount.Value;
                        payment                 = new Cash();
                        bankDeposit.Amount      = new Money(amount, iSabayaContext.imSabayaConfig.DefaultCurrency);
                        bankDeposit.BankAccount = ToBankAccount;
                        bankDeposit.PaymentDate = paymentDate.Date;
                        bankDeposit.AmountForThisTransaction = amount;
                    }
                    else if (payType.Equals("Cheque"))
                    {
                        amountCheque = (decimal)spnChequeAmount.Value;
                        amountChequeForTransaction = (decimal)spnChequeUsedAmount.Value;
                        Cheque c = FindByChequeNo(iSabayaContext, bteChequeNo.Text);
                        if (c == null) // New Cheque
                        {
                            payment = new Cheque();
                            Cheque cheque = (Cheque)payment;
                            cheque.Amount     = new Money(amountCheque, iSabayaContext.imSabayaConfig.DefaultCurrency);
                            cheque.StatusDate = DateTime.Now;
                            cheque.AmountForThisTransaction = amountChequeForTransaction;
                            cheque.Bank             = BankControl1.Organization;
                            cheque.ChequeNo         = bteChequeNo.Text;
                            cheque.ChequeDate       = (DateTime)ChequeDate.Date;
                            cheque.PaymentDate      = paymentDate.Date;
                            cheque.PrintChequeDate  = TimeInterval.MaxDate;
                            bankDeposit.Amount      = cheque.Amount;
                            bankDeposit.BankAccount = ToBankAccount;
                            bankDeposit.PaymentDate = paymentDate.Date;
                            bankDeposit.DueDate     = cheque.DueDate.Date;
                            bankDeposit.AmountForThisTransaction = amountChequeForTransaction;
                            bankDeposit.Cheque = cheque;
                        }
                        else // 0ld Cheque
                        {
                            c.AmountForThisTransaction           = amountChequeForTransaction;
                            bankDeposit.Amount                   = c.Amount;
                            bankDeposit.PaymentDate              = paymentDate.Date;
                            bankDeposit.DueDate                  = c.DueDate.Date;
                            bankDeposit.AmountForThisTransaction = amountChequeForTransaction;
                            bankDeposit.Cheque                   = c;
                        }
                    }
                    payments.Add(bankDeposit);
                }

                #endregion BankDeposit

                #region FundTransfer

                else if (payMethod.Equals("FundTransfer"))
                {
                    amount = (decimal)spnAmount.Value;
                    FundTransfer fundTransfer = new FundTransfer();
                    fundTransfer.PaymentType              = "FundTransfer";
                    fundTransfer.FromBankAccount          = FromBankAccount;
                    fundTransfer.ToBankAccount            = ToBankAccount;
                    fundTransfer.Amount                   = new Money(Convert.ToDecimal(amount.ToString()), iSabayaContext.imSabayaConfig.DefaultCurrency);
                    fundTransfer.AmountForThisTransaction = fundTransfer.Amount.Amount;
                    fundTransfer.PaymentDate              = DateTime.Now;
                    if (fundTransfer.FromBankAccount == null)
                    {
                        throw new ApplicationException("ไม่พบบัญชีต้นทาง");
                    }
                    if (fundTransfer.ToBankAccount == null)
                    {
                        throw new ApplicationException("ไม่พบบัญชีปลายทาง");
                    }
                    payments.Add(fundTransfer);
                }

                #endregion FundTransfer

                #region Cash

                else if (payMethod.Equals("Cash"))
                {
                    amount  = (decimal)spnAmount.Value;
                    payment = new Cash();
                    Cash cash = (Cash)payment;
                    cash.PaymentType = "Cash";
                    cash.Amount      = new Money(Convert.ToDecimal(amount.ToString()), iSabayaContext.imSabayaConfig.DefaultCurrency);
                    cash.PaymentDate = DateTime.Now.Date;
                    cash.AmountForThisTransaction = amount;
                    payments.Add(cash);
                }

                #endregion Cash

                #region Cheque

                else if (payMethod.Equals("Cheque"))
                {
                    amountCheque = (decimal)spnChequeAmount.Value;
                    amountChequeForTransaction = (decimal)spnChequeUsedAmount.Value;
                    Cheque c = FindByChequeNo(iSabayaContext, bteChequeNo.Text);
                    if (c == null) // New cheque
                    {
                        payment             = new Cheque();
                        payment.PaymentType = "Cheque";
                        Cheque cheque = (Cheque)payment;
                        cheque.Amount                   = new Money(amountCheque, iSabayaContext.imSabayaConfig.DefaultCurrency);
                        cheque.PaymentDate              = DateTime.Now.Date;
                        cheque.StatusDate               = DateTime.Now;
                        cheque.PrintChequeDate          = TimeInterval.MinDate;
                        cheque.AmountForThisTransaction = amountChequeForTransaction;
                        cheque.Bank            = BankControl1.Organization;
                        cheque.ChequeNo        = bteChequeNo.Text;
                        cheque.ChequeDate      = (DateTime)ChequeDate.Date;
                        cheque.PayableTo       = "";
                        cheque.PrintChequeDate = TimeInterval.MaxDate;
                        payments.Add(cheque);
                    }
                    else
                    {
                        c.AmountForThisTransaction = amountChequeForTransaction;
                        payments.Add(c);
                    }
                }

                #endregion Cheque

                #region BillPayment

                else if (payMethod.Equals("BillPayment"))
                {
                    //no class
                    BillPayment billPayment = new BillPayment();
                    billPayment.PaymentType = "Bill Payment";
                    if (payType.Equals("Cash"))
                    {
                        amount  = (decimal)spnAmount.Value;
                        payment = new Cash();
                        Cash cash = (Cash)payment;
                        billPayment.Amount      = new Money(Convert.ToDecimal(amount.ToString()), iSabayaContext.imSabayaConfig.DefaultCurrency);
                        billPayment.PaymentDate = paymentDate.Date.Date;
                        billPayment.AmountForThisTransaction = amount;
                    }
                    else if (payType.Equals("Cheque"))
                    {
                        amountCheque = (decimal)spnChequeAmount.Value;
                        amountChequeForTransaction = (decimal)spnChequeUsedAmount.Value;
                        Cheque c = FindByChequeNo(iSabayaContext, bteChequeNo.Text);
                        if (c == null) // New cheque
                        {
                            payment = new Cheque();
                            Cheque cheque = (Cheque)payment;
                            cheque.Amount      = new Money(amountCheque, iSabayaContext.imSabayaConfig.DefaultCurrency);
                            cheque.PaymentDate = paymentDate.Date.Date;
                            cheque.StatusDate  = paymentDate.Date.Date;
                            cheque.AmountForThisTransaction = amountChequeForTransaction;
                            cheque.Bank            = BankControl1.Organization;
                            cheque.ChequeNo        = bteChequeNo.Text;
                            cheque.ChequeDate      = (DateTime)ChequeDate.Date;
                            cheque.PayableTo       = "";
                            cheque.PrintChequeDate = TimeInterval.MaxDate;
                            //special for bank deposit
                            billPayment.Amount      = cheque.Amount;
                            billPayment.PaymentDate = cheque.PaymentDate;
                            billPayment.DueDate     = cheque.DueDate.Date;
                            billPayment.AmountForThisTransaction = amountChequeForTransaction;
                            //special for bank deposit
                            billPayment.Cheque = cheque;
                        }
                        else // Old cheque
                        {
                            c.AmountForThisTransaction = amountChequeForTransaction;
                            billPayment.Cheque         = c;
                        }
                    }
                    payments.Add(billPayment);
                }

                #endregion BillPayment

                Session["listPayment"] = payments;
            }

            #endregion Add Payment

            gridPaymetod.DataSource = Session["listPayment"];
            gridPaymetod.DataBind();
        }
        public void Excluir(Cheque cheque)
        {
            try
            {
                Cheque chequeAux = new Cheque();
                chequeAux.ID = cheque.ID;

                List<Cheque> resultado = this.Consultar(chequeAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new ChequeNaoExcluidoExcecao();

                chequeAux = resultado[0];

                db.Cheque.DeleteOnSubmit(chequeAux);

            }
            catch (Exception)
            {

                throw new ChequeNaoExcluidoExcecao();
            }
        }
Esempio n. 21
0
        public MemoryStream Render(Cheque cheque)
        {
            var stream = new MemoryStream();

            return(ConstructReport(stream, cheque));
        }
Esempio n. 22
0
 public abstract void Devolver(Cheque cheque, DateTime dataEvento, string motivo);
        /*************    Metodos privados       *************/
        private void realizarRetiro()
        {
            Boolean validador;
            validador = Validaciones.validarCampoVacio(txtNroDoc) & Validaciones.validarCampoVacio(txtImporte) & Validaciones.validarCampoVacio(txtNroCheque) & Validaciones.validarCampoVacio(txtNombreLibrar);
            validador = validador & Validaciones.validarCampoNumericoDouble(txtImporte) & Validaciones.validarCampoNumericoEntero(txtNroDoc) & Validaciones.validarCampoNumericoEntero(txtNroCheque) & Validaciones.validarCampoString(txtNombreLibrar);
            if (validador)
            {
                try
                {
                    validarCuentaHabilitada();
                    validarSaldoDisponible();
                    validarNumeroDocumento();
                    validarImporteEnDolares();

                    Cheque cheque = new Cheque();
                    cheque.numero = Int64.Parse(txtNroCheque.Text);
                    cheque.fecha = FECHA_ACTUAL;
                    cheque.importe = Double.Parse(txtImporte.Text);
                    cheque.codigoBanco = ((Banco)comboBanco.SelectedItem).codigo;
                    cheque.monedaTipo = ((TipoMoneda)comboTipoMoneda.SelectedItem).codigo;
                    cheque.nombreDestinatario = txtNombreLibrar.Text;

                    Entities.Retiro retiro = new Entities.Retiro();
                    retiro.cheque = cheque;

                    retiro.importe = cheque.importe;
                    retiro.fecha = cheque.fecha;
                    retiro.cuenta = Int64.Parse(comboCuentaOrigen.Text);
                    retiro.codigoCheque = cheque.numero;

                    retiroService.GuardarRetiro(retiro);

                    MessageBox.Show("Se ha realizado el retiro de saldo. ", "Retiro realizado satisfactoriamente", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    limpiarDatos();

                }
                catch (OperationCanceledException ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "No se pudo realizar el retiro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (SqlException ex)
                {
                    if (ex.Number == 2627)
                    {
                        MessageBox.Show("El numero de cheque ya existe", "No se pudo realizar el retiro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 24
0
 public int SendCheque(Cheque cheque)
 {
     return(_chequeRepository.SaveCheque(cheque));
 }
        public HttpResponseMessage Get()
        {
            var cheque = new Cheque();

            return(ToJson(cheque));
        }
Esempio n. 26
0
        public async Task <HttpResponseMessage> SaveReceiveAndPay([FromBody] PayRecevie payRecevie)
        {
            try
            {
                var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId);

                FinanYearRule finanYearRule = new FinanYearRule();
                var           finanYerar    = await finanYearRule.GetCurrentFinanYear(organId);

                var documentNumber   = 0;
                int payRecevieNumber = 0;

                if (payRecevie.ID > 0)
                {
                    PayRecevie temp = new PayRecevie();
                    temp = payRecevie;
                    PayRecevieRule payRecevieRule = new PayRecevieRule();
                    payRecevieRule.Delete(payRecevie.ID);

                    documentNumber   = payRecevie.Document.Number;
                    payRecevieNumber = payRecevie.Number;

                    await payRecevieRule.SaveChangesAsync();
                }

                payRecevie.ID = -1;

                if (payRecevie.Contact != null)
                {
                    payRecevie.ContactId           = payRecevie.Contact.ID;
                    payRecevie.Contact.ObjectState = OMF.Common.Enums.ObjectState.Unchanged;
                }


                if (payRecevie.Invoice != null)
                {
                    payRecevie.InvoiceId           = payRecevie.Invoice.ID;
                    payRecevie.Invoice.ObjectState = OMF.Common.Enums.ObjectState.Unchanged;
                }

                if (payRecevie.Cost != null)
                {
                    payRecevie.CostId           = payRecevie.Cost.ID;
                    payRecevie.Cost.ObjectState = OMF.Common.Enums.ObjectState.Unchanged;
                }


                payRecevie.OrganId = organId;

                payRecevie.Type        = payRecevie.Type;
                payRecevie.Date        = PersianDateUtils.ToDateTime(payRecevie.DisplayDate);
                payRecevie.DisplayDate = payRecevie.DisplayDate;
                // payRecevie.Date = DateTime.Now;
                //payRecevie.DisplayDate = Utilities.PersianDateUtils.ToPersianDate(DateTime.Now);
                decimal amount = 0;
                foreach (var item in payRecevie.Items)
                {
                    amount += item.Amount;

                    if (item.Cash != null)
                    {
                        item.CashId = item.Cash.ID;
                    }
                    else if (item.Bank != null)
                    {
                        item.BankId = item.Bank.ID;
                    }
                    else if (item.Cheque != null && item.Type == ZhivarEnums.DetailPayReceiveType.Cheque)
                    {
                        Cheque cheque = new Cheque()
                        {
                            Amount       = item.Amount,
                            BankBranch   = item.Cheque.BankBranch,
                            BankName     = item.Cheque.BankName,
                            ChequeNumber = item.Cheque.ChequeNumber,
                            Contact      = payRecevie.Contact,
                            ContactId    = payRecevie.Contact.ID,
                            Date         = PersianDateUtils.ToDateTime(item.Cheque.DisplayDate),
                            OrganId      = organId,
                            Status       = ZhivarEnums.ChequeStatus.Normal,
                            DisplayDate  = item.Cheque.DisplayDate,
                        };

                        if (payRecevie.IsReceive)
                        {
                            cheque.Type = ZhivarEnums.ChequeType.Dareaftani;
                        }
                        else
                        {
                            cheque.Type = ZhivarEnums.ChequeType.Pardakhtani;
                        }

                        if (item.Cheque.ReceiptDate != null)
                        {
                            cheque.ReceiptDate = item.Cheque.ReceiptDate;
                        }


                        item.Cheque             = cheque;
                        item.ChequeId           = item.Cheque.ID;
                        item.Cheque.ObjectState = OMF.Common.Enums.ObjectState.Added;

                        if (!payRecevie.IsReceive)
                        {
                            var temp = item.ChequeBank.ID;

                            item.ChequeBank = new ChequeBank()
                            {
                                BankId   = temp,
                                ChequeId = item.Cheque.ID,
                                OrganId  = organId
                            };

                            item.ChequeBank.ObjectState = OMF.Common.Enums.ObjectState.Added;
                            item.ChequeBankId           = item.ChequeBank.ID;
                        }

                        item.ObjectState = OMF.Common.Enums.ObjectState.Added;
                    }

                    if (item.Type == ZhivarEnums.DetailPayReceiveType.KharjCheque)
                    {
                        ChequeRule chequeRule = new ChequeRule();
                        var        cheque     = await chequeRule.FindAsync(item.Cheque.ID);

                        cheque.Status = ZhivarEnums.ChequeStatus.Sold;
                        chequeRule.Update(cheque);
                        await chequeRule.SaveChangesAsync();

                        item.Cheque.ContactId = item.Cheque.Contact.ID;
                    }

                    item.ObjectState = OMF.Common.Enums.ObjectState.Added;
                }

                payRecevie.Amount = amount;

                if (payRecevie.Invoice != null)
                {
                    //if (payRecevie.Invoice.Contact != null)
                    payRecevie.Invoice.ContactId = payRecevie.Invoice.ContactId;

                    //payRecevie.Invoice.FinanYear = finanYerar;
                    //payRecevie.Invoice.FinanYearId = finanYerar.ID;
                    var invoice = payRecevie.Invoice;
                    invoice.Rest -= amount;
                    invoice.Paid += amount;
                    if (invoice.Rest <= 0)
                    {
                        invoice.Status = ZhivarEnums.NoeInsertFactor.Received;
                    }
                    this.BusinessRule.UnitOfWork.RepositoryAsync <Invoice>().Update(invoice);
                }

                if (payRecevie.Cost != null)
                {
                    //if (payRecevie.Cost.Contact != null)
                    payRecevie.Cost.ContactId = payRecevie.Cost.ContactId;


                    var cost = payRecevie.Cost;
                    cost.Rest -= amount;
                    cost.Paid += amount;
                    if (cost.Rest <= 0)
                    {
                        cost.Status = ZhivarEnums.CostStatus.Paid;
                    }


                    this.BusinessRule.UnitOfWork.RepositoryAsync <Cost>().Update(cost);
                }

                payRecevie.Document = await createDocument(payRecevie, organId, documentNumber);

                if (payRecevieNumber > 0)
                {
                    payRecevie.Number = payRecevieNumber;
                }
                else
                {
                    var payRecevies = await Rule.GetAllByOrganIdAsync(organId);

                    var lastPayRecevies = payRecevies.OrderByDescending(x => x.ID).FirstOrDefault();

                    if (lastPayRecevies != null)
                    {
                        payRecevie.Number = lastPayRecevies.Number + 1;
                    }
                    else
                    {
                        payRecevie.Number = 1;
                    }
                }

                foreach (var transaction in payRecevie.Document.Transactions)
                {
                    transaction.ObjectState = OMF.Common.Enums.ObjectState.Added;
                    //if (transaction.AccDocument != null)
                    //    transaction.AccDocument.ObjectState = OMF.Common.Enums.ObjectState.Unchanged;

                    if (transaction.Account != null)
                    {
                        transaction.Account.ObjectState = OMF.Common.Enums.ObjectState.Unchanged;
                    }

                    // transaction.Transactions = null;
                }
                payRecevie.Document.ObjectState = OMF.Common.Enums.ObjectState.Added;

                payRecevie.ObjectState = OMF.Common.Enums.ObjectState.Added;
                this.BusinessRule.UnitOfWork.RepositoryAsync <PayRecevie>().InsertOrUpdateGraph(payRecevie);

                await this.BusinessRule.UnitOfWork.SaveChangesAsync();

                return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = payRecevie }));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public HttpResponseMessage Error()
        {
            var cheque = new Cheque();

            return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid cheque date"));
        }
Esempio n. 28
0
 public Cheque ajouterCheque(Cheque c)
 {
     return(idao.ajouterCheque(c));
 }
Esempio n. 29
0
 public async Task<ActionResult> GetChequesByCount(Cheque cheque)
 {
     Log.Info("Received a request to save the receipt");
     
     return Ok(await _chequeRepository.Insert(cheque));
 }
Esempio n. 30
0
 public void Add(Cheque cheque)
 {
     List.Add(cheque);
 }
Esempio n. 31
0
 public RemovedChequeEvent(Cheque cheque) : base(cheque)
 {
 }
 public ChequeModel(Cheque cheque)
 {
     this.IsNew = false;
     this.Amount = cheque.Payment.TotalAmount;
     var Bank = Context.Banks.SingleOrDefault(entity => entity.PartyRoleId == cheque.BankPartyRoleId);
     this.BankId = Bank.PartyRoleId;
     this.BankName = Bank.PartyRole.Party.Organization.OrganizationName;
     this.ChequeId = cheque.Id;
     this.ChequeNumber = cheque.Payment.PaymentReferenceNumber;
     this.TransactionDate = cheque.Payment.TransactionDate;
     this.ChequeDate = cheque.CheckDate;
     this.PaymentId = cheque.PaymentId;
     this.ReceiptId = cheque.PaymentId;
     var chequeStatus = Context.ChequeStatus.SingleOrDefault(entity => entity.CheckId == cheque.Id && entity.IsActive == true);
     if (chequeStatus != null)
     {
         this.Status = chequeStatus.ChequeStatusType.Name;
     }
 }
Esempio n. 33
0
 public override void Repassar(Cheque cheque, DateTime dataEvento, Fornecedor fornecedor)
 {
     cheque.MudarEstado(new ChequeRepassado(dataEvento, fornecedor));
 }
Esempio n. 34
0
        public ClientResponse getObtenerChequeXId(int ID)
        {
            try
            {
                using (conexion = new SqlConnection(ConexionDAO.cnx))
                {
                    using (comando = new SqlCommand("usp_sel_cheque_x_id", conexion))
                    {
                        comando.CommandType = CommandType.StoredProcedure;
                        comando.Parameters.AddWithValue("@id", ID);
                        conexion.Open();
                        using (reader = comando.ExecuteReader())
                        {
                            if (reader.Read())
                            {
                                entidad = new Cheque();

                                entidad.ID         = (reader["ID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["ID"].ToString());
                                entidad.CampaniaID = (reader["CampaniaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["CampaniaID"]);

                                using (CampañasDAO oCampDao = new CampañasDAO())
                                {
                                    entidad.listCampañas = oCampDao.ListarCampañas();
                                }
                                entidad.InstitucionEducativaID = (reader["InstitucionEducativaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["InstitucionEducativaID"]);
                                using (InstitucionEducativaDAO db = new InstitucionEducativaDAO())
                                {
                                    entidad.listInstitucionEducativa = db.getLstByCampania(entidad.CampaniaID);
                                }
                                using (CiaSeguro_DAO db = new CiaSeguro_DAO())
                                {
                                    entidad.listCIASeguro = db.getLstbyInst(entidad.InstitucionEducativaID);
                                }
                                entidad.CIASeguroID = (reader["CIASeguroID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["CIASeguroID"]);

                                using (TipoSeguro_DAO db = new TipoSeguro_DAO())
                                {
                                    entidad.listProducto = db.getLstbyInstAseg(entidad.InstitucionEducativaID, entidad.CIASeguroID);
                                }
                                entidad.ProductoID = (reader["ProductoID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["ProductoID"]);
                                entidad.BancoID    = (reader["BancoID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["BancoID"]);
                                entidad.MonedaID   = (reader["MonedaID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["MonedaID"]);
                                using (BancoDAO db = new BancoDAO())
                                {
                                    entidad.listBanco = db.ListarBanco();
                                }
                                using (MonedaDAO db = new MonedaDAO())
                                {
                                    entidad.listMoneda = db.getLstbyInstAsegProd(entidad.InstitucionEducativaID, entidad.CIASeguroID, entidad.ProductoID);
                                }
                                entidad.Fecha     = Convert.ToDateTime(reader["Fecha"]);
                                entidad.NroCheque = (reader["NroCheque"] == DBNull.Value) ? "" : reader["NroCheque"].ToString();
                                entidad.Monto     = (reader["Monto"] == DBNull.Value) ? 0 : Convert.ToDecimal(reader["Monto"]);
                                entidad.Concepto  = (reader["Concepto"] == DBNull.Value) ? "" : reader["Concepto"].ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clientResponse.Mensaje = ex.Message;
                clientResponse.Status  = "ERROR";
            }
            finally
            {
                conexion.Close();
                conexion.Dispose();
                comando.Dispose();
                reader.Dispose();
            }
            clientResponse.DataJson = JsonConvert.SerializeObject(entidad).ToString();
            return(clientResponse);
        }
Esempio n. 35
0
 public override void Devolver(Cheque cheque, DateTime dataEvento, string motivo)
 {
     cheque.MudarEstado(new ChequeDevolvido(dataEvento, motivo));
 }
Esempio n. 36
0
        public ClientResponse Grabar(Cheque cheque)
        {
            try
            {
                using (conexion = new SqlConnection(ConexionDAO.cnx))
                {
                    using (comando = new SqlCommand("usp_upd_cheque", conexion))
                    {
                        comando.Parameters.AddWithValue("@CampaniaID", cheque.CampaniaID);
                        comando.Parameters.AddWithValue("@InstitucionEducativaID", cheque.InstitucionEducativaID);
                        comando.Parameters.AddWithValue("@CIASeguroID", cheque.CIASeguroID);
                        comando.Parameters.AddWithValue("@ProductoID", cheque.ProductoID);
                        comando.Parameters.AddWithValue("@BancoID", cheque.BancoID);
                        comando.Parameters.AddWithValue("@MonedaID", cheque.MonedaID);
                        comando.Parameters.AddWithValue("@fecha", cheque.Fecha);
                        comando.Parameters.AddWithValue("@NroCheque", cheque.NroCheque);
                        comando.Parameters.AddWithValue("@Monto", cheque.Monto);
                        comando.Parameters.AddWithValue("@UsuarioActualizacion", cheque.UsuarioActualizacion);
                        comando.Parameters.AddWithValue("@FechaActualizacion", cheque.FechaActualizacion);
                        comando.Parameters.AddWithValue("@Activo", cheque.Activo);
                        comando.Parameters.AddWithValue("@id", cheque.ID);
                        comando.Parameters.Add("@mensaje", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
                        comando.Parameters.Add("@status", SqlDbType.VarChar, 5).Direction    = ParameterDirection.Output;
                        comando.CommandType = CommandType.StoredProcedure;
                        conexion.Open();
                        comando.ExecuteNonQuery();
                        //clientResponse.Mensaje = "El cheque se ha Actualizado Satisfactoriamente.";
                        //clientResponse.Status = "OK";

                        clientResponse.Mensaje = comando.Parameters["@mensaje"].Value.ToString();
                        clientResponse.Status  = comando.Parameters["@status"].Value.ToString();

                        if (clientResponse.Status == "ERROR")
                        {
                            throw new Exception(clientResponse.Mensaje);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clientResponse.Mensaje = ex.Message;
                clientResponse.Status  = "ERROR";
            }

            finally
            {
                conexion.Close();
                conexion.Dispose();
                comando.Dispose();
            }
            return(clientResponse);
            //using (BDHermesBancarizacionEntities db = new BDHermesBancarizacionEntities())
            //{
            //    bool existe = (db.Cheque.Where(p => p.ID == cheque.ID).Count() > 0);
            //    if (existe == true)
            //    {
            //        Cheque oCheque = db.Cheque.Where(p => p.ID == cheque.ID).FirstOrDefault();
            //        oCheque.ID = cheque.ID;
            //        oCheque.CampaniaID = cheque.CampaniaID;
            //        oCheque.InstitucionEducativaID = cheque.InstitucionEducativaID;
            //        oCheque.CIASeguroID = cheque.CIASeguroID;
            //        oCheque.ProductoID = cheque.ProductoID;
            //        oCheque.BancoID = cheque.BancoID;
            //        oCheque.MonedaID = cheque.MonedaID;
            //        oCheque.Fecha = cheque.Fecha;
            //        oCheque.NroCheque = cheque.NroCheque;
            //        oCheque.Monto = cheque.Monto;
            //        oCheque.UsuarioActualizacion = cheque.UsuarioActualizacion;
            //        oCheque.FechaActualizacion = cheque.FechaActualizacion;
            //    }
            //    return db.SaveChanges();
            //}
        }
Esempio n. 37
0
 public abstract void Bloquear(Cheque cheque, DateTime dataEvento);
Esempio n. 38
0
 public override void Bloquear(Cheque cheque, DateTime dataEvento)
 {
     cheque.MudarEstado(new ChequeBloqueado(dataEvento));
 }
Esempio n. 39
0
 public abstract void Compensar(Cheque cheque, DateTime dataEvento);
Esempio n. 40
0
 public override void Repassar(Cheque cheque, DateTime dataEvento, Cliente cliente)
 {
     cheque.MudarEstado(new ChequeRepassado(dataEvento, cliente));
 }
Esempio n. 41
0
 public abstract void Repassar(Cheque cheque, DateTime dataEvento, Fornecedor fornecedor);