示例#1
0
        private void rdbAbono_CheckedChanged(object sender, EventArgs e)
        {
            double monto = 0;

            try
            {
                if (rdbSaldar.Checked)
                {
                    txtMonto.SetValor(saldo.ToString("N2"));
                    txtMonto.ReadOnly  = true;
                    txtMontoLetra.Text = Numalet.ToCardinal(saldo).ToUpper();
                }
                else if (rdbPonerseAldia.Checked)
                {
                    txtMonto.SetValor(totalVP.ToString("N2"));
                    txtMonto.ReadOnly  = true;
                    txtMontoLetra.Text = Numalet.ToCardinal(totalVP).ToUpper();
                }
                else
                {
                    txtMonto.SetValor(montoCuota.ToString("N2"));
                    txtMonto.ReadOnly  = false;
                    txtMontoLetra.Text = Numalet.ToCardinal(montoCuota).ToUpper();
                    txtMonto.Focus();
                }

                monto = objUtil.ConvertirANumero(txtMonto.Text);
                SetValorEncabezado("Monto", monto);
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
        public override void ImprimirEnMatricial()
        {
            ELRLogicaNegocio.Cajas lCaja = new ELRLogicaNegocio.Cajas();
            double monto = 0;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                monto = objUtil.GetAsDouble("Monto", DTVistaData.Rows[0]);

                lCaja.DTDataCXC       = DTVistaData;
                lCaja.NombreImpresora = impresoraDefault;
                lCaja.montoLetra      = Numalet.ToCardinal(monto);
                lCaja.logo            = logoEmpresa;

                //MANDAMOS a Imprimir en un Thread
                Thread tAux = new Thread(new ThreadStart(lCaja.ImprimirReciboOtrosMatricial80));
                tAux.Start();

                while (!tAux.IsAlive)
                {
                    ;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        public override void MostrarDataRegistroSel()
        {
            string cedulaRNC, nombre;
            double monto      = 0;
            int    facturaNo  = 0;
            int    prestamoId = 0;

            try
            {
                cedulaRNC  = objUtil.GetAsString("CedulaRNC", drRegistroSel);
                nombre     = objUtil.GetAsString("Nombre_Entidad", drRegistroSel);
                monto      = objUtil.GetAsDouble("Monto_Inicial", drRegistroSel);
                facturaNo  = objUtil.GetAsInt("Factura_Numero", drRegistroSel);
                prestamoId = objUtil.GetAsInt("Prestamo_Id", drRegistroSel);

                txtCedulaRNC.Text     = cedulaRNC;
                txtNombreEntidad.Text = nombre;
                txtMonto.Text         = monto.ToString("N2");
                lblMontoLetra.Text    = Numalet.ToCardinal(monto).ToUpper();
                txtConcepto.Text      = "INICIAL FACTURA NO.: " + facturaNo.ToString().PadLeft(7, '0');

                Text = "INICIAL FACTURA NO.: " + facturaNo.ToString().PadLeft(7, '0');

                SetValorEncabezado("Factura_Numero", facturaNo);
                SetValorEncabezado("Documento_Id", prestamoId);
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
                Close();
            }
        }
示例#4
0
        public override void Imprimir()
        {
            string valorUnico = "0";
            double monto      = 0;

            DataRow fila0 = null;

            try
            {
                if (MyData == null)
                {
                    return;
                }
                if (MyData.Rows.Count == 0)
                {
                    return;
                }

                valorUnico  = DataGridConsulta["Unico", DataGridConsulta.CurrentRow.Index].Value.ToString();
                fila0       = MyData.Select("Unico = " + valorUnico)[0];
                reciboId    = objUtil.GetAsString("Recibo_Id", fila0, "0");
                monto       = objUtil.GetAsDouble("Monto", fila0);
                montoLetras = Numalet.ToCardinal(monto);

                DTData    = objDB.GetById("VCAJAS_RECIBOS", reciboId, "Recibo_Id");
                DTDetalle = objDB.GetById("TPRESTAMOS_DETALLE_COBRADO", reciboId, "Recibo_Id");

                ImprimirRDLC();
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
示例#5
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string    valorUnico = "0";
            string    valorId = "0";
            string    pathReporte = "";
            DataRow   fila0 = null;
            double    monto = 0;
            DataTable DTDetalle = null, DTData = null;

            WinControl_ELR_NET.ELRFormPreviewRDLC frm = new WinControl_ELR_NET.ELRFormPreviewRDLC();
            try
            {
                if (MyData == null)
                {
                    return;
                }
                if (MyData.Rows.Count == 0)
                {
                    return;
                }

                pathReporte = objUtil.GetPathReportRDLC("RptCreditoRecibo");

                valorUnico = DataGridConsulta["Unico", DataGridConsulta.CurrentRow.Index].Value.ToString();
                fila0      = MyData.Select("Unico = " + valorUnico)[0];

                if (DataGridConsulta.Columns[e.ColumnIndex] is DataGridViewLinkColumn && e.RowIndex >= 0)
                {
                    valorId     = objUtil.GetAsString("Recibo_Id", fila0, "0");
                    monto       = objUtil.GetAsDouble("Monto", fila0);
                    montoLetras = Numalet.ToCardinal(monto);

                    DTData    = objDB.GetById("VCAJAS_RECIBOS", valorId, "Recibo_Id");
                    DTDetalle = objDB.GetById("TPRESTAMOS_DETALLE_COBRADO", valorId, "Recibo_Id");

                    frm.pathReporte   = pathReporte;
                    frm.DTOficina     = DTOficina;
                    frm.nombreUsuario = nombreUsuario;
                    frm.titulo        = "RECIBO NO.: " + valorId.PadLeft(7, '0');
                    frm.AddDS("DSData", DTData);
                    frm.AddDS("DSDetalle", DTDetalle);
                    frm.AddParm("MONTO_LETRAS", montoLetras.ToUpper());

                    frm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                frm.Dispose();
                DTData    = null;
                DTDetalle = null;
            }
        }
示例#6
0
        private void xrLabel83_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            Numalet let = null;

            let = new Numalet();
            //al uso en México (creo):
            let.MascaraSalidaDecimal   = "00/100 M.N.";
            let.SeparadorDecimalSalida = "pesos";
            //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
            let.ApocoparUnoParteEntera = true;
            //MessageBox.Show("Son: " + let.ToCustomCardinal(1121.24));
            xrLabel83.Text = let.ToCustomCardinal(decimal.Parse(xrLabel83.Text));
            //Son: un mil ciento veintiún pesos 24/100 M.N.
        }
示例#7
0
        private void txtMonto_Leave(object sender, EventArgs e)
        {
            double monto = 0;

            try
            {
                monto = double.Parse(txtMonto.Text);
                txtMontoLetra.Text = Numalet.ToCardinal(monto).ToUpper();
            }
            catch (Exception)
            {
                throw;
            }
        }
        public override void TotalizarDetalle()
        {
            //base.TotalizarDetalle();
            double monto       = 0;
            double montoAPagar = 0;
            string concepto    = "";

            try
            {
                txtConcepto.Text = "";

                monto = GetSum("Monto_APagar", DSDatos.Tables["Detalle"]);
                txtMontoLetra.Text = Numalet.ToCardinal(monto).ToUpper();

                btnGrabar.Enabled = (monto > 0);

                foreach (DataRow item in DSDatos.Tables["Detalle"].Rows)
                {
                    monto       = objUtil.GetAsDouble("Monto_Pendiente", item);
                    montoAPagar = objUtil.GetAsDouble("Monto_APagar", item);

                    if (montoAPagar > 0)
                    {
                        if (concepto.Trim().Length > 0)
                        {
                            concepto += ", ";
                        }
                        if (montoAPagar >= monto)
                        {
                            concepto += "SALDO " + objUtil.GetAsString("Concepto", item);
                        }
                        else
                        {
                            concepto += "ABONO A " + objUtil.GetAsString("Concepto", item);
                        }
                    }
                }

                txtConcepto.Text = concepto;

                if (concepto.Trim() != "")
                {
                    btnGrabar.Focus();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public override void ImprimirPreviewRDLC()
        {
            double monto = 0;

            try
            {
                monto       = objUtil.GetAsDouble("Monto", DTVistaData.Rows[0]);
                montoLetras = Numalet.ToCardinal(monto);
                base.ImprimirPreviewRDLC();
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
        private void txtMonto_Leave(object sender, EventArgs e)
        {
            double monto = 0;

            try
            {
                lblMontoLetra.Text = "";

                monto = double.Parse(txtMonto.Text);
                lblMontoLetra.Text = Numalet.ToCardinal(monto).ToUpper();
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
        public ActionResult Retencion(string Documento, string RIF, string PDF, int TipoRetencion)
        {
            if (PDF != null && PDF.ToLower() == "true")
            {
                PortalProveedoresEntities contexto = new PortalProveedoresEntities();
                var proveedor = contexto.BioProveedores.Where(p => p.RIF == RIF).FirstOrDefault();
                var Retencion = contexto.BioRetencionFacturas.Where(p => p.Factura == Documento && p.RIF == RIF && p.CodRetencion == TipoRetencion).FirstOrDefault();

                ViewBag.MontoLetras = Numalet.ToCardinal(Retencion.Retencion);
                ViewBag.Proveedor   = proveedor;
                ViewBag.Retencion   = Retencion;
                return(View("Retencion"));
            }
            else
            {
                return(GeneraPDF(Documento, RIF, "Comprobante Retención ", Request.Url.ToString() + "&PDF=true"));
            }
        }
        public async Task <ActionResult <CheckAccountLines> > Insert([FromBody] CheckAccountLines _CheckAccountLines)
        {
            CheckAccountLines _CheckAccountLinesq = new CheckAccountLines();

            try
            {
                _CheckAccountLinesq = _CheckAccountLines;

                Numalet let;
                let = new Numalet();
                let.SeparadorDecimalSalida      = "Lempiras";
                let.MascaraSalidaDecimal        = "00/100 ";
                let.ApocoparUnoParteEntera      = true;
                _CheckAccountLinesq.AmountWords = let.ToCustomCardinal((_CheckAccountLinesq.Ammount)).ToUpper();
                _CheckAccountLinesq.IdEstado    = 1;
                _CheckAccountLinesq.Estado      = "Activo";
                //Conteo Cheques
                CheckAccount chequera = await _context.CheckAccount.Where(c => c.CheckAccountId == _CheckAccountLinesq.CheckAccountId).FirstOrDefaultAsync();

                chequera.NumeroActual = Convert.ToInt32(_CheckAccountLines.CheckNumber);
                if (chequera.NumeroActual > Convert.ToInt32(chequera.NoFinal))
                {
                    return(BadRequest("No se pueden emitir más Cheques."));
                }
                else
                {
                    _context.CheckAccountLines.Add(_CheckAccountLinesq);
                    CheckAccount _CheckAccountq = await(from c in _context.CheckAccount
                                                        .Where(q => q.CheckAccountId == _CheckAccountLinesq.CheckAccountId)
                                                        select c
                                                        ).FirstOrDefaultAsync();

                    _context.Entry(_CheckAccountq).CurrentValues.SetValues((chequera));
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(await Task.Run(() => BadRequest($"Ocurrio un error:{ex.Message}")));
            }

            return(await Task.Run(() => Ok(_CheckAccountLinesq)));
        }
示例#13
0
        private void Calcular()
        {
            double xtotal         = 0;
            double xcant          = 0;
            double xprecio        = 0;
            double ximporte       = 0;
            double xsubtotal      = 0;
            double xigv           = 0;
            double xutili         = 0;
            double ximport_Utili  = 0;
            double xtotalGanancia = 0;

            for (int i = 0; i < lsv_Det.Items.Count; i++)
            {
                xcant   = Convert.ToDouble(lsv_Det.Items[i].SubItems[2].Text);
                xprecio = Convert.ToDouble(lsv_Det.Items[i].SubItems[3].Text);

                ximporte = xprecio * xcant;
                lsv_Det.Items[i].SubItems[4].Text = ximporte.ToString("###0.00");

                xutili        = Convert.ToDouble(lsv_Det.Items[i].SubItems[7].Text);
                ximport_Utili = xutili * xcant;

                xtotal = xtotal + Convert.ToDouble(lsv_Det.Items[i].SubItems[4].Text);

                xtotalGanancia = xtotalGanancia + Convert.ToDouble(lsv_Det.Items[i].SubItems[8].Text);
            }
            xsubtotal = xtotal / 1.16;

            xigv = xsubtotal * 0.16;

            lbl_subtotal.Text      = xsubtotal.ToString("###0.00");
            lbl_igv.Text           = xigv.ToString("###0.00");
            lbl_TotalPagar.Text    = xtotal.ToString("###0.00");
            lbl_totalGanancia.Text = xtotalGanancia.ToString("###0.00");
            lbl_son.Text           = Numalet.ToString(lbl_TotalPagar.Text);

            let.LetraCapital = chkCapital.Checked;

            if (!actualizaco)
            {
                ActualizarConfig();
            }
        }
        public override void ImprimirEnOtroFormato()
        {
            string nombreArchivo = "";
            string logoEmpresa   = "";
            Bitmap imgLogo;
            double monto = 0;

            try
            {
                nombreArchivo = Environment.CurrentDirectory + @"\Reportes\cajaReciboOtros.frx";
                monto         = objUtil.GetAsDouble("Monto", DTVistaData.Rows[0]);
                montoLetras   = Numalet.ToCardinal(monto);

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(nombreArchivo);
                    report.RegisterData(DTVistaData, "VCAJAS_RECIBOS");
                    report.RegisterData(DTOficina, "VEMPRESAS_OFICINAS");

                    report.SetParameterValue("MONTO_LETRA", montoLetras);

                    //Vamos a asignar el logo
                    logoEmpresa = Environment.CurrentDirectory + @"\images\logo.png";

                    if (File.Exists(logoEmpresa))
                    {
                        imgLogo = (Bitmap)Image.FromFile(logoEmpresa);
                        FastReport.PictureObject ptLogo = report.FindObject("ptLogo") as FastReport.PictureObject;
                        ptLogo.Image = imgLogo;
                    }

                    report.PrintSettings.ShowDialog = false;
                    report.PrintSettings.Printer    = impresoraDefault;
                    report.Print();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#15
0
        public override void ImprimirPreviewRDLC()
        {
            double    monto = 0;
            string    valorId = "0", pathReporte = "";
            DataRow   fila0     = null;
            DataTable DTDetalle = null;

            WinControl_ELR_NET.ELRFormPreviewRDLC frm = new WinControl_ELR_NET.ELRFormPreviewRDLC();

            try
            {
                fila0       = DTVistaData.Rows[0];
                valorId     = objUtil.GetAsString("Recibo_Id", fila0, "0");
                monto       = objUtil.GetAsDouble("Monto", fila0);
                montoLetras = Numalet.ToCardinal(monto);
                pathReporte = objUtil.GetPathReportRDLC("RptCreditoRecibo");


                DTDetalle = objDB.GetById("TPRESTAMOS_DETALLE_COBRADO", valorId, "Recibo_Id");

                frm.pathReporte   = pathReporte;
                frm.DTOficina     = DTOficina;
                frm.nombreUsuario = nombreUsuario;
                frm.titulo        = "RECIBO NO.: " + valorId.PadLeft(7, '0');
                frm.AddDS("DSData", DTVistaData);
                frm.AddDS("DSDetalle", DTDetalle);
                frm.AddParm("MONTO_LETRAS", montoLetras.ToUpper());

                frm.ShowDialog();
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                DTDetalle = null;
                frm.Dispose();
            }
        }
        public async Task <ActionResult <InsurancesCertificateLine> > Insert([FromBody] InsurancesCertificateLine _InsurancesCertificateLine)
        {
            InsurancesCertificateLine _InsurancesCertificateLineq = new InsurancesCertificateLine();

            try
            {
                _InsurancesCertificateLineq = _InsurancesCertificateLine;
                _context.InsurancesCertificateLine.Add(_InsurancesCertificateLineq);
                Numalet let;
                let = new Numalet();
                let.SeparadorDecimalSalida = "Lempiras";
                let.MascaraSalidaDecimal   = "00/100 ";
                let.ApocoparUnoParteEntera = true;
                _InsurancesCertificateLineq.TotalLetras = let.ToCustomCardinal((_InsurancesCertificateLineq.TotalofProductLine)).ToUpper();
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_InsurancesCertificateLineq)));
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string nombre = "", dni = "", domicilio = "", distrito = "", memexp = " ", memmvc = " ", memlight = " ", memsta = " ", memplus = " ", memtop = " ", memvit = " ";
                    string duracion = "", fechafin = "", montototaldolareletras = "", tipocambio = "", montototalsoles = "", numerodecuotas = "", opcontado = "", op6cuotas = "", op12cuotas = "";
                    string op24cuotas = "", op36cuotas = "", op48cuotas = "", op60cuotas = "", opotros = "", porcentajefinan = "", porprimcuo = "", soles6cuotas = "", soles12cuotas = "", soles24cuotas = "", soles36cuotas = "", soles48cuotas = "";
                    string soles60cuotas = "", solesotros = " Otros";
                    string code = "", username = "";
                    string coname = "", civilState = "";
                    string memevolu = " ";
                    /*push*/
                    //Session["datos"] = "Nombre|Apellidos|birthDay|M|DocumentType|NroDoc$NombreC|ApellidoC|1|313231c$bankName|nombreBankAccount|TypeAccount|nroAccount|nroTaxer|SocialReason|fiscalAdress|UserType$email|nroCell|nroCell2|country|State|City|Adress";
                    //Session["carrito"] = "6000.00|descripcionDB|60|9750.00|3.25|10|TOP";
                    //Session["cronograma"] = "6000|222";

                    string currencyCode = Session["TypeCurrency"].ToString();

                    civilState = Session["CivilState"].ToString().ToUpper();

                    string[] datos   = Session["datos"].ToString().Split('$');
                    string[] carrito = Session["carrito"].ToString().Trim().Split('|');
                    string[] cronograma;
                    string   totaldolares = "";
                    int      flag         = 0;
                    string   test         = (string)Session["cronograma"];
                    if (!string.IsNullOrEmpty(test))
                    {
                        cronograma   = Session["cronograma"].ToString().Split('|');
                        totaldolares = ((Double.Parse(cronograma[0])).ToString());
                        flag++;
                    }

                    string[] arrayperson   = datos[0].Split('|');
                    string[] arraycoperson = datos[1].Split('|');
                    string[] arraycontacto = datos[3].Split('|');
                    //  string totaldolares = ((Double.Parse(cronograma[0])).ToString());
                    string primeracuota = carrito[3];

                    coname = arraycoperson[0].ToUpper() + " " + arraycoperson[1].ToUpper();
                    if (string.IsNullOrEmpty(coname.Trim()))
                    {
                        coname = "__________________________________________";
                    }


                    tipocambio = carrito[4];
                    double typeChange = double.Parse(tipocambio);
                    numerodecuotas = carrito[2];
                    nombre         = arrayperson[0].ToUpper() + " " + arrayperson[1].ToUpper();
                    dni            = arrayperson[5];

                    username  = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                    domicilio = arraycontacto[6].ToUpper();
                    distrito  = arraycontacto[5].ToUpper();


                    //vamos al servidor por el tiempo de duracion
                    BrMembershipPayDetail brPayDetail = new BrMembershipPayDetail();
                    duracion = brPayDetail.GetDuration(carrito[6]);
                    /*resconpesa= wilii*/
                    if (carrito[6] == "EVO")
                    {
                        //duracion = "15";
                        memevolu = "X";
                        //fechafin = "______";
                    }
                    if (carrito[6] == "MVC")
                    {
                        memmvc = "X";
                        //duracion = "1";
                    }
                    if (carrito[6] == "EXP")
                    {
                        memexp = "X";
                        //duracion = "2";
                    }
                    if (carrito[6] == "LHT")
                    {
                        //duracion = "4";
                        memlight = "X";
                    }
                    if (carrito[6] == "STD")
                    {
                        //duracion = "7";
                        memsta = "X";
                    }
                    if (carrito[6] == "PLUS")
                    {
                        //duracion = "10";
                        memplus = "X";
                    }
                    if (carrito[6] == "TOP")
                    {
                        //duracion = "15";
                        memtop = "X";
                        //fechafin = "______";
                    }
                    if (carrito[6] == "VIT")
                    {
                        duracion = "VITALICIO";
                        memvit   = "X";
                        fechafin = "--";
                    }
                    else
                    {
                        //para que la suma sea menos un dia 2021-08-22
                        DateTime fecha = DateTime.Parse("2022-08-21");

                        int duracion1 = int.Parse(duracion.Split('.')[0]);
                        int duracion2 = int.Parse(duracion.Split('.')[1]);

                        fecha = fecha.AddYears(duracion1);
                        if (duracion2 > 0)
                        {
                            fecha = fecha.AddMonths(duracion2);
                        }

                        fechafin = Convert.ToDateTime(fecha).ToString("dd/MM/yyyy");
                        duracion = " DE " + duracion1 + " AÑOS";
                    }
                    Numalet numalet       = new Numalet();
                    double  totaldolaresv = numalet.TwoDecimas(double.Parse(totaldolares));
                    montototaldolareletras  = numalet.ToCustomCardinal(totaldolaresv).ToUpper();
                    montototaldolareletras += " Dolares ( " + totaldolaresv.ToString("###,###,##0.00") + " USD ).".ToUpper();
                    double totalsolesv = numalet.TwoDecimas(double.Parse(totaldolares) * double.Parse(tipocambio));
                    montototalsoles  = numalet.ToCustomCardinal(totalsolesv).ToUpper();
                    montototalsoles += " Soles ( " + totalsolesv.ToString("###,###,##0.00") + " PEN).".ToUpper();


                    //la primera cuota viene en soles y tenemos el total en soles
                    porprimcuo      = numalet.TwoDecimas((((double.Parse(primeracuota) * Double.Parse(tipocambio)) * 100) / totalsolesv)).ToString();
                    porcentajefinan = numalet.TwoDecimas((100 - double.Parse(porprimcuo))).ToString();

                    BrPayments brPayments   = new BrPayments();
                    double     interesanual = brPayments.CalculateMonthlyRate(10);

                    double montofinanciar = totalsolesv - (double.Parse(primeracuota) * double.Parse(tipocambio));

                    /*asdasdasd*/
                    string[] array1   = Session["cronogramaYa"].ToString().Split('^');
                    string[] datosMem = array1[0].Split('|');
                    string[] array2   = array1[1].Split('~');
                    string[] cuotas   = array2[0].Split('¬');

                    int    interruptor    = 0;
                    string cuotasMenSoles = "";
                    for (int i = 0; i < cuotas.Length - 1; i++)
                    {
                        var fila = cuotas[i].Split('|');
                        if (fila[0].Substring(0, 7) != "Inicial" && fila[0].Substring(0, 7) != "Upgrade")
                        {
                            if (interruptor != 1)
                            {
                                interruptor    = 1;
                                cuotasMenSoles = fila[5].Replace("S/.", "");
                            }
                        }
                    }
                    string montoletrastercero = "";
                    montoletrastercero = " un valor de " + montototaldolareletras + " los cuales al tipo de cambio del día " + tipocambio +
                                         " , serían " + montototalsoles;

                    double amountSoles = double.Parse(cuotasMenSoles);
                    if (currencyCode == "USD")
                    {
                        amountSoles        = amountSoles / typeChange;
                        montoletrastercero = " un valor de " + montototaldolareletras;
                    }
                    /*asdasdasd*/

                    // double mothycuod = brPayments.CalculeMonthlyQuote(montofinanciar, int.Parse(numerodecuotas), interesanual);
                    string mothycuo = numalet.TwoDecimas(amountSoles).ToString();
                    //double sd =  brPayments.CalculateFinancingPercentage(1, 1);


                    switch (int.Parse(numerodecuotas))
                    {
                    case 1: opcontado = "X"; break;

                    case 6: op6cuotas = "X"; soles6cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 12: op12cuotas = "X"; soles12cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 24: op24cuotas = "X"; soles24cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 36: op36cuotas = "X"; soles36cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 48: op48cuotas = "X"; soles48cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 60: op60cuotas = "X"; soles60cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    default:
                        opotros = "X"; solesotros = numerodecuotas + " Cuotas – Cada cuota de (S/." + mothycuo.ToString() + " )";
                        break;
                    }

                    //un valor de [@montototaldolaresletras] los cuales al tipo de cambio del día [@tipocambio] , serían [@montototalsoles]

                    string fechahoy = DateTime.Now.ToString("dd/MM/yyyy");

                    //reportViewer1.LocalReport.ReportPath = @"http://localhost:50447/Views/FilesContratos/Contrato.rdlc";
                    //ReportViewer1.LocalReport.DataSources.Clear();
                    //ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", _midetalle_venta))TRY MERGE;
                    //reportViewer1.
                    tipocambio = "( " + tipocambio + " )";
                    ReportParameter[] parametros = new ReportParameter[37];
                    parametros[0]  = new ReportParameter("name", nombre);
                    parametros[1]  = new ReportParameter("dni", dni);
                    parametros[2]  = new ReportParameter("estadocivil", civilState);
                    parametros[3]  = new ReportParameter("domicilio", domicilio);
                    parametros[4]  = new ReportParameter("distrito", distrito);
                    parametros[5]  = new ReportParameter("memexp", memexp);
                    parametros[6]  = new ReportParameter("memlight", memlight);
                    parametros[7]  = new ReportParameter("memsta", memsta);
                    parametros[8]  = new ReportParameter("memplus", memplus);
                    parametros[9]  = new ReportParameter("memtop", memtop);
                    parametros[10] = new ReportParameter("duracion", duracion);
                    parametros[11] = new ReportParameter("fechafin", fechafin);
                    parametros[12] = new ReportParameter("montototaldolaresletras", montototaldolareletras);
                    parametros[13] = new ReportParameter("tipocambio", tipocambio);
                    parametros[14] = new ReportParameter("montototalsoles", montototalsoles);
                    parametros[15] = new ReportParameter("numerodecuotas", numerodecuotas);
                    parametros[16] = new ReportParameter("opcontado", opcontado);
                    parametros[17] = new ReportParameter("op6cuotas", op6cuotas);
                    parametros[18] = new ReportParameter("op12cuotas", op12cuotas);
                    parametros[19] = new ReportParameter("op24cuotas", op24cuotas);
                    parametros[20] = new ReportParameter("op36cuotas", op36cuotas);
                    parametros[21] = new ReportParameter("op48cuotas", op48cuotas);
                    parametros[22] = new ReportParameter("op60cuotas", op60cuotas);
                    parametros[23] = new ReportParameter("opotros", opotros);
                    // parametros[24] = new ReportParameter("porcentajefinan", porcentajefinan);
                    // parametros[25] = new ReportParameter("porprimcuo", porprimcuo);
                    parametros[24] = new ReportParameter("soles6cuotas", soles6cuotas);
                    parametros[25] = new ReportParameter("soles12cuotas", soles12cuotas);
                    parametros[26] = new ReportParameter("soles24cuotas", soles24cuotas);
                    parametros[27] = new ReportParameter("soles36cuotas", soles36cuotas);
                    parametros[28] = new ReportParameter("soles48cuotas", soles48cuotas);
                    parametros[29] = new ReportParameter("soles60cuotas", soles60cuotas);
                    parametros[30] = new ReportParameter("solesotros", solesotros);
                    parametros[31] = new ReportParameter("coname", coname);
                    parametros[32] = new ReportParameter("memmvc", memmvc);
                    parametros[33] = new ReportParameter("fechahoy", fechahoy);
                    parametros[34] = new ReportParameter("memvit", memvit);
                    parametros[35] = new ReportParameter("montoletrastercero", montoletrastercero);
                    parametros[36] = new ReportParameter("memevolu", memevolu);

                    reportViewer1.LocalReport.SetParameters(parametros);
                    reportViewer1.LocalReport.Refresh();


                    //reportViewer1.Enabled = false;


                    ////Le indicamos al Control que la invocación del reporte será de modo remoto
                    //reportViewer1.ProcessingMode = ProcessingMode.Remote;
                    ////Le indicamos la URL donde se encuentra hospedado Reporting Services
                    //reportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer");
                    ////Le indicamos la carpeta y el Reporte que deseamos Ver
                    //reportViewer1.ServerReport.ReportPath = "/DemoRS/Contacto";
                    ////Definimos los parámetros
                    //ReportParameter parametro = new ReportParameter();
                    //parametro.Name = "name";
                    //parametro.Values.Add("2");//txtContactID.Text
                    //                          //Aqui le indicaremos si queremos que el parámetro
                    //                          //sea visible para el usuario o no
                    //parametro.Visible = false;

                    ////Crearemos un arreglo de parámetros
                    //ReportParameter[] rp = { parametro };
                    ////Ahora agregamos el parámetro en al reporte
                    //reportViewer1.ServerReport.SetParameters(rp);
                    //reportViewer1.ServerReport.Refresh();


                    byte[] bytes       = reportViewer1.LocalReport.Render("PDF");
                    string correlativo = "";
                    correlativo = Session["correlativoDoc"].ToString();
                    string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/" + "CON" + username + correlativo);
                    if (File.Exists(ruta))
                    {
                        File.Delete(ruta);
                    }
                    using (FileStream fs = new FileStream(ruta + ".pdf", FileMode.Create))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("Error.aspx?error=" + ex.Message, true);
            }
        }
示例#18
0
        public override void Imprimir()
        {
            string    valorUnico    = "0";
            string    valorId       = "0";
            string    nombreReporte = "";
            int       tipoTrans     = 0;
            DataRow   MyFila        = null;
            DataTable DTVistaData   = null;

            ELRLogicaNegocio.Cajas lCaja = new ELRLogicaNegocio.Cajas();
            double monto         = 0;
            string nombreArchivo = "";
            string logoURL;
            Bitmap imgLogo;

            try
            {
                objUtil = new WinControl_ELR_NET.ELRUtils();

                if (dataGridView1.RowCount > 0)
                {
                    this.Cursor = Cursors.WaitCursor;

                    valorUnico  = dataGridView1["Unico", dataGridView1.CurrentRow.Index].Value.ToString();
                    MyFila      = MyData.Select("Unico = " + valorUnico)[0];
                    valorId     = objUtil.GetAsString("Recibo_Id", MyFila, "0");
                    tipoTrans   = objUtil.GetAsInt("Tipo_Trans", MyFila);
                    monto       = objUtil.GetAsDouble("Monto", MyFila);
                    montoLetras = Numalet.ToCardinal(monto);

                    DTVistaData = objDB.GetById("VCAJAS_RECIBOS", valorId, "Recibo_Id");

                    lCaja.DTDataCXC       = DTVistaData;
                    lCaja.montoLetra      = montoLetras;
                    lCaja.numeroCopias    = IMPRIME_TICKET_COPIA;
                    lCaja.NombreImpresora = impresoraDefault;
                    lCaja.logo            = logoEmpresa;
                    lCaja.MOSTRAR_DETALLE_FACTURAS_PAGADAS = MOSTRAR_DETALLE_FACTURAS_PAGADAS;

                    if (tipoTrans == 1)
                    {
                        nombreReporte = "RptReciboCaja";


                        if (metodoImp == 1)
                        {
                            lCaja.ImprimirTicketReciboCXC();
                        }
                        else if (metodoImp == 2)
                        {
                            lCaja.ImprimirReciboMatricial80();
                        }
                        else
                        {
                            ImprimirPreviewRDLC(nombreReporte, "VCAJAS_RECIBOS", valorId, "Recibo_Id");
                        }
                    }
                    else
                    {
                        nombreReporte = "RptReciboCajaOtros";

                        if (metodoImp == 1)
                        {
                            lCaja.ImprimirTicketOtrosIngresos(DTVistaData, IMPRIME_TICKET_COPIA, impresoraDefault);
                        }
                        else if (metodoImp == 2)
                        {
                            lCaja.ImprimirReciboOtrosMatricial80();
                        }
                        else
                        {
                            ImprimirPreviewRDLC(nombreReporte, "VCAJAS_RECIBOS", valorId, "Recibo_Id");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#19
0
        private void btImprimi_Click(object sender, EventArgs e)
        {
            ImprimirOrden printOrden = new ImprimirOrden();
            printOrden._idorden = _idorden;
            printOrden._iddetalles = _iddetalles;
            printOrden._idproveedor = _idproveedor;
            printOrden._subtotal = _subtotal;
            printOrden._iva = _iva;
            printOrden._total = _total;

            Numalet let = new Numalet();
            //al uso en México (creo):

            if (tbMoneda.Text.Equals("DOLARES"))
            {
                let.MascaraSalidaDecimal = "00/100";
                let.SeparadorDecimalSalida = "dolares";
            }
            else
            {
                let.MascaraSalidaDecimal = "00/100 M.N.";
                let.SeparadorDecimalSalida = "pesos";
            }

            //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
            let.ApocoparUnoParteEntera = true;

            //Son: un mil ciento veintiún pesos 24/100 M.N.
            //float fe = (float)Convert.ToDouble(tbTotal.Text);
            frmNuevaOrden frmNueva = new frmNuevaOrden();
            frmNueva.Show();
            if (chbLetra.Checked)
            {
                printOrden._conletra = let.ToCustomCardinal(estetotal).ToUpper();
            }
            else
            {
                printOrden._conletra = "";
            }

            printOrden.Show();

            this.Close();
        }
示例#20
0
        public async Task <ActionResult <DebitNote> > Insert([FromBody] DebitNote _DebitNote)
        {
            DebitNote _DebitNoteq = new DebitNote();

            try
            {
                using (var transaction = _context.Database.BeginTransaction())
                {
                    try
                    {
                        _DebitNoteq = _DebitNote;
                        if (!_DebitNote.Fiscal)
                        {
                            DebitNote _debitnote = await _context.DebitNote.Where(q => q.BranchId == _DebitNote.BranchId)
                                                   .Where(q => q.IdPuntoEmision == _DebitNote.IdPuntoEmision)
                                                   .FirstOrDefaultAsync();

                            if (_debitnote != null)
                            {
                                _DebitNoteq.NúmeroDEI = _context.DebitNote.Where(q => q.BranchId == _DebitNote.BranchId)
                                                        .Where(q => q.IdPuntoEmision == _DebitNote.IdPuntoEmision).Max(q => q.NúmeroDEI);
                            }

                            _DebitNoteq.NúmeroDEI += 1;


                            //  Int64 puntoemision = _context.Users.Where(q=>q.Email==_DebitNoteq.UsuarioCreacion).Select(q=>q.)

                            Int64 IdCai = await _context.NumeracionSAR
                                          .Where(q => q.BranchId == _DebitNoteq.BranchId)
                                          .Where(q => q.IdPuntoEmision == _DebitNoteq.IdPuntoEmision)
                                          .Where(q => q.Estado == "Activo").Select(q => q.IdCAI).FirstOrDefaultAsync();


                            if (IdCai == 0)
                            {
                                return(BadRequest("No existe un CAI activo para el punto de emisión"));
                            }

                            // _DebitNoteq.Sucursal = await _context.Branch.Where(q => q.BranchId == _DebitNote.BranchId).Select(q => q.BranchCode).FirstOrDefaultAsync();
                            //  _DebitNoteq.Caja = await _context.PuntoEmision.Where(q=>q.IdPuntoEmision== _Invoice.IdPuntoEmision).Select(q => q.PuntoEmisionCod).FirstOrDefaultAsync();
                            _DebitNoteq.CAI = await _context.CAI.Where(q => q.IdCAI == IdCai).Select(q => q._cai).FirstOrDefaultAsync();
                        }
                        Numalet let;
                        let = new Numalet();
                        let.SeparadorDecimalSalida = "Lempiras";
                        let.MascaraSalidaDecimal   = "00/100 ";
                        let.ApocoparUnoParteEntera = true;
                        _DebitNoteq.TotalLetras    = let.ToCustomCardinal((_DebitNoteq.Total)).ToUpper();

                        _DebitNoteq = _DebitNote;
                        _context.DebitNote.Add(_DebitNoteq);

                        foreach (var item in _DebitNote.DebitNoteLine)
                        {
                            item.DebitNoteId = _DebitNote.DebitNoteId;
                            _context.DebitNoteLine.Add(item);
                        }


                        await _context.SaveChangesAsync();

                        JournalEntry _je = new JournalEntry
                        {
                            Date         = _DebitNoteq.DebitNoteDate,
                            Memo         = "Nota de débito de clientes",
                            DatePosted   = _DebitNoteq.DebitNoteDueDate,
                            ModifiedDate = DateTime.Now,
                            CreatedDate  = DateTime.Now,
                            ModifiedUser = _DebitNoteq.UsuarioModificacion,
                            CreatedUser  = _DebitNoteq.UsuarioCreacion,
                            DocumentId   = _DebitNoteq.DebitNoteId,
                            VoucherType  = 4,
                        };

                        Accounting account = new Accounting();


                        foreach (var item in _DebitNoteq.DebitNoteLine)
                        {
                            account = await _context.Accounting.Where(acc => acc.AccountId == item.AccountId).FirstOrDefaultAsync();

                            _je.JournalEntryLines.Add(new JournalEntryLine
                            {
                                AccountId    = Convert.ToInt32(item.AccountId),
                                AccountName  = account.AccountName,
                                Description  = account.AccountName,
                                Credit       = item.Total,
                                Debit        = 0,
                                CreatedDate  = DateTime.Now,
                                ModifiedDate = DateTime.Now,
                                CreatedUser  = _DebitNoteq.UsuarioCreacion,
                                ModifiedUser = _DebitNoteq.UsuarioModificacion,
                                Memo         = "Nota de débito",
                            });
                        }
                        _context.JournalEntry.Add(_je);
                        await _context.SaveChangesAsync();

                        BitacoraWrite _write = new BitacoraWrite(_context, new Bitacora
                        {
                            IdOperacion  = _DebitNote.DebitNoteId,
                            DocType      = "DebitNote",
                            ClaseInicial =
                                Newtonsoft.Json.JsonConvert.SerializeObject(_DebitNote, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            ResultadoSerializado = Newtonsoft.Json.JsonConvert.SerializeObject(_DebitNote, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            Accion            = "Insert",
                            FechaCreacion     = DateTime.Now,
                            FechaModificacion = DateTime.Now,
                        });

                        await _context.SaveChangesAsync();

                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(await Task.Run(() => BadRequest($"Ocurrio un error:{ex.Message}")));
            }

            return(await Task.Run(() => Ok(_DebitNoteq)));
        }
示例#21
0
        public string Pagares()
        {
            string[] datos      = Session["datos"].ToString().Split('$');
            string[] carrito    = Session["carrito"].ToString().Split('|');
            string[] cronograma = Session["cronogramaYa"].ToString().Split('|');

            string[] arrayperson    = datos[0].Split('|');
            string[] arraycontacto  = datos[3].Split('|');
            string   totaldolares   = cronograma[0];
            string   primeracuota   = carrito[3];
            string   tipocambio     = carrito[4];
            string   numerodecuotas = carrito[2];
            string   codemem        = carrito[6];

            string  fechaActual = DateTime.Now.ToLongDateString();
            Numalet numalet     = new Numalet();
            string  codigo      = "";
            string  nombre      = "";
            string  dni         = "";
            string  domicilio   = "";
            string  username    = "";


            nombre   = arrayperson[0].ToUpper() + " " + arrayperson[1].ToUpper();
            dni      = arrayperson[5];
            username = (arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni).ToUpper();

            dni = arrayperson[5];
            string userName = (arrayperson[0].Substring(0, 1) + arrayperson[1].Substring(0, 1) + dni).ToUpper();

            domicilio = arraycontacto[6];
            string distrito = arraycontacto[5];
            string correo   = arraycontacto[0];
            string telefono = arraycontacto[1];

            string fecha = DateTime.Now.ToString("dd-MM-yyyy");



            string[] array1   = Session["cronogramaYa"].ToString().Split('^');
            string[] datosMem = array1[0].Split('|');
            string[] array2   = array1[1].Split('~');

            string[] cuotas = array2[0].Split('¬');
            Session["nQuotes"] = cuotas;
            decimal totalpagar = 0, interestotal = 0, importefinanciado = 0, porcefinanciado = 0, valorcuotas = 0;
            int     ncuotas = 0, interruptor = 0;
            string  fechacuotas = "";

            List <Pagare> listPagare = new List <Pagare>();

            for (int i = 0; i < cuotas.Length - 1; i++)
            {
                var fila = cuotas[i].Split('|');
                if (fila[0].Substring(0, 7) != "Inicial")
                {
                    totalpagar   += decimal.Parse(fila[5].Replace("S/.", ""));
                    interestotal += decimal.Parse(fila[4].Replace("S/.", ""));
                    ncuotas++;

                    if (interruptor != 1)
                    {
                        interruptor       = 1;
                        importefinanciado = decimal.Parse(fila[2].Replace("S/.", ""));
                        fechacuotas       = DateTime.Parse(fila[1]).ToString("dd/MM/yyyy");
                        valorcuotas       = decimal.Parse(fila[5].Replace("S/.", ""));
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        listPagare.Add(new Pagare
                        {
                            Id               = 1,
                            Codigo           = codigo,
                            NombreCompleto   = nombre,
                            Dni              = dni,
                            Domicilio        = domicilio,
                            Fecha            = fechaActual,
                            FechaCuotas      = DateTime.Parse(fila[1]).ToString("dd/MM/yyyy"),
                            MontoSoles       = decimal.Parse(fila[5].Replace("S/.", "")),
                            MontoSolesLetras = numalet.ToCustomCardinal(decimal.Parse(fila[5].Replace("S/.", ""))),
                            NCuotas          = 1,
                            ValorCuotas      = decimal.Parse(fila[5].Replace("S/.", ""))
                        });
                    }
                }
            }
            porcefinanciado = (importefinanciado * 100) / decimal.Parse(datosMem[0]);

            listPagare.Add(new Pagare
            {
                Id               = 1,
                Codigo           = codigo,
                NombreCompleto   = nombre,
                Dni              = dni,
                Domicilio        = domicilio,
                Fecha            = fechaActual,
                FechaCuotas      = fechacuotas,
                MontoSoles       = importefinanciado,
                MontoSolesLetras = numalet.ToCustomCardinal(importefinanciado),
                NCuotas          = ncuotas,
                ValorCuotas      = valorcuotas
            });


            string cadenfinal = string.Empty;

            for (int i = 0; i < listPagare.Count; i++)
            {
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 12pt;font-weight: bold;'>PAGARÉ CODIGO: " + userName.ToUpper() + "-" + (i + 1).ToString() + "</div>";
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;font-weight: bold;'>POR UN VALOR DE( " + listPagare[i].MontoSolesLetras + " Soles)</div>";
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;font-weight: bold;'>(S/." + listPagare[i].MontoSoles.ToString() + ")ESTE VALOR ES EL SALDO A FINANCIAR</div>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Yo <b>" + listPagare[i].NombreCompleto + "</b> identificado(a) con DNI Nº <b>" + listPagare[i].Dni + "</b> con domicilio y residencia en <b>" + listPagare[i].Domicilio + "</b>.</p>" +
                              "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Me comprometo a pagar incondicionalmente a VALLE ENCANTADO S.A.C " +
                              "la suma de <b>" + listPagare[i].MontoSolesLetras + " Soles (S/. " + listPagare[i].MontoSoles + ")</b> pagadero en <b>" + listPagare[i].NCuotas + "</b> cuotas mensuales y consecutivas con vencimiento la primera " +
                              "de ella el día <b>" + listPagare[i].FechaCuotas + "</b>, por valor de <b>(S/." + listPagare[i].ValorCuotas + ")</b>.El pago de dichas cuotas se realizará en Soles a razón del cambio oficial vigente" +
                              " a la fecha en que se efectúe éste. En caso de mora y mientras ella subsista pagaré intereses moratorios a la tasa máxima establecida para" +
                              " el periodo correspondiente. De igual manera me obligo a pagar todos los gastos y costos de la cobranza judicial. </p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En el evento en que el deudor no pague en el plazo" +
                              " estipulado una o más cuotas, el tenedor de este título podrá declarar vencidos todos los plazos de esta obligación y pedir su inmediato" +
                              " pago total o el pago del saldo.</p>";

                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>También acepto que <b>VALLE ENCANTADO S.A.C</b>, declare de plazo vencido la obligación a la que se refiere este pagaré y exigir su pago total en el evento en que sea perseguido judicialmente. El recibo de abono de parciales no implica novación y cualquier pago que se efectúe se imputará primero a gastos, penalidades, y por último a capital. El suscriptor de este pagaré hace constatar que la obligación de pagarla indivisiblemente y solidariamente subsiste en caso de prórroga o prórrogas o de cualquier modificación a lo estipulado. El deudor declara que la suma que debe conforme a este pagaré, no estará sujeta ni a deducción ni a descuentos de cualquier naturaleza, incluyendo sin limitación cualquier impuesto que pueda gravar su pago, por lo tanto, en caso de existir alguna de estas deducciones o descuentos, el deudor deberá aumentar la suma a pagar de tal manera que el tenedor reciba siempre el valor estipulado del pagaré. El deudor acepta desde ahora el endoso, cesión o transferencia que de este pagaré a VALLE ENCANTADO S.A.C. todos los gastos e impuestos relacionados con la suscripción de este pagaré serán por cuenta del deudor.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Todos los pagos que deban hacerse según este pagaré serán hechos exclusivamente en Soles, a la<b> Cuenta Recaudadora Soles BCP N°192-2459697-0-22</b>, en su oficina central ubicada en Av. Guardia Civil 1321 oficina 602 – Surquillo o en Ribera del Río Club Resort ubicada en Mz. B Lt. 72. Tercera Etapa - Cieneguilla.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Todos los cálculos de intereses se efectuarán sobre la base de un año de trescientos sesenta (360) días, en cada caso por el número de días efectivamente transcurridos (incluyendo el primer día, pero excluyendo el último día) durante el pazo por el cual deban pagarse tale intereses. Si cualquiera de las fechas de pago de principal o intereses antes indicadas coincidiera con un día no hábil, se entenderá que el pago respectivo deberá ser efectuado el día hábil inmediatamente siguiente." +
                              "Cualquier referencia en este pagaré al agente deberá entenderse efectuada a cualquier tenedor del mismo, sea que lo adquiera por endoso o de otro modo.</p>";

                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En caso de mora, no será necesario requerimiento alguno para que el Cliente incurra en la misma, de acuerdo a lo establecido en el artículo 1333 inciso 1 del Código Civil Peruano. En dicho caso, durante todo el periodo de incumplimiento el cliente pagara a una tasa equivalente al máximo de interés permitido por la ley, por concepto de interés moratorio.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>De conformidad con lo establecido por el artículo 158.2 concordante con el artículo 52° de la Ley de Títulos Valores, este pagaré no requerirá ser protestado por la falta de pago de cualquiera de las cuotas para ejercitar las acciones derivadas del mismo.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Adicionalmente, el cliente se obliga incondicionalmente a pagar al Agente todos los gastos en que éste incurra en razón de su incumplimiento, obligándose a pagar sobre éstos el mismo interés moratorio pactado en este pagaré.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Asimismo, el cliente acepta las renovaciones y prórrogas de vencimiento de este pagaré que el agente considere conveniente efectuar, ya sea por su importe parcial o total, aun cuando no hayan sido comunicadas al cliente. Dichas modificaciones serán anotadas en este mismo instrumento o en hoja anexa, sin que sea necesaria la suscripción de tal instrumento.</p>";

                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Este pagare se devolverá a su cancelación total. Queda expresamente establecido que el domicilio del cliente es <b>" + listPagare[i].Domicilio + " - Lima Perú</b>, lugar a donde se dirigirán todas las comunicaciones y notificaciones derivadas de este pagaré.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Queda establecido que las obligaciones contenidas en este pagaré, constituyendo el presente acuerdo pacto en contrario a lo dispuesto por el artículo 1233° del Código Civil.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Este pagaré se regirá bajo las leyes de la República del Perú.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Cualquier acción o procedimiento legal relacionado con y derivado del presente pagaré podrá ser iniciado ante los órganos judiciales del Cercado de Lima, Lima, Perú. El cliente renuncia a la jurisdicción de cualquier otro tribunal que pudiere corresponderle por cualquier otra razón.</p>";
                cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En constancia de lo anterior, se firma el presente pagaré el día <b>" + listPagare[i].Fecha + "</b> en la ciudad de Lima,El Deudor.</p>";

                cadenfinal += "<br /><br /><br /><br />";
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>______________________________</div>";
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>FIRMA</div>";
                cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>DNI:<b>" + listPagare[i].Dni + "</b></div>";
                if (listPagare[i].Domicilio.Length < 30)
                {
                    cadenfinal += "<br />";
                }
                cadenfinal += "<br />";
            }
            return(cadenfinal);
        }
示例#22
0
 /// <summary>
 /// Convert double to words
 /// </summary>
 /// <returns>The words.</returns>
 /// <param name="number">Number.</param>
 public static string ToWords(this double number)
 {
     return(Numalet.ToCardinal(number));
 }
示例#23
0
        public async Task <ActionResult <Invoice> > InsertConAlarma([FromBody] Invoice _Invoice)
        {
            Invoice _Invoiceq = new Invoice();
            ElementoConfiguracion _elemento = new ElementoConfiguracion();
            bool GenerateAlert = false;

            try
            {
                using (var transaction = _context.Database.BeginTransaction())
                {
                    try
                    {
                        _Invoiceq = _Invoice;

                        Invoice _invoice = await _context.Invoice.Where(q => q.BranchId == _Invoice.BranchId)
                                           .Where(q => q.IdPuntoEmision == _Invoice.IdPuntoEmision)
                                           .FirstOrDefaultAsync();

                        if (_invoice != null)
                        {
                            _Invoiceq.NumeroDEI = _context.Invoice.Where(q => q.BranchId == _Invoice.BranchId)
                                                  .Where(q => q.IdPuntoEmision == _Invoice.IdPuntoEmision).Max(q => q.NumeroDEI);
                        }

                        _Invoiceq.NumeroDEI += 1;


                        //  Int64 puntoemision = _context.Users.Where(q=>q.Email==_Invoiceq.UsuarioCreacion).Select(q=>q.)

                        Int64 IdCai = await _context.NumeracionSAR
                                      .Where(q => q.BranchId == _Invoiceq.BranchId)
                                      .Where(q => q.IdPuntoEmision == _Invoiceq.IdPuntoEmision)
                                      .Where(q => q.Estado == "Activo").Select(q => q.IdCAI).FirstOrDefaultAsync();


                        if (IdCai == 0)
                        {
                            return(BadRequest("No existe un CAI activo para el punto de emisión"));
                        }

                        //_Invoiceq.Sucursal = await _context.Branch.Where(q => q.BranchId == _Invoice.BranchId).Select(q => q.BranchCode).FirstOrDefaultAsync();
                        //  _Invoiceq.Caja = await _context.PuntoEmision.Where(q=>q.IdPuntoEmision== _Invoice.IdPuntoEmision).Select(q => q.PuntoEmisionCod).FirstOrDefaultAsync();
                        _Invoiceq.CAI = await _context.CAI.Where(q => q.IdCAI == IdCai).Select(q => q._cai).FirstOrDefaultAsync();

                        Numalet let;
                        let = new Numalet();
                        let.SeparadorDecimalSalida = "Lempiras";
                        let.MascaraSalidaDecimal   = "00/100 ";
                        let.ApocoparUnoParteEntera = true;
                        _Invoiceq.TotalLetras      = let.ToCustomCardinal((_Invoiceq.Total)).ToUpper();

                        _context.Invoice.Add(_Invoiceq);

                        _elemento = await _context.ElementoConfiguracion.Where(q => q.Id == 76).FirstOrDefaultAsync();

                        if (_elemento != null)
                        {
                            if (_Invoiceq.CurrencyId == 1)
                            {
                                if (_Invoiceq.Total > _elemento.Valordecimal)
                                {
                                    GenerateAlert = true;
                                }
                            }
                            else
                            {
                                ExchangeRate rate = new ExchangeRate();
                                rate = await _context.ExchangeRate.Where(q => q.DayofRate == _Invoiceq.InvoiceDate && q.CurrencyId == _Invoiceq.CurrencyId).FirstOrDefaultAsync();

                                if (rate != null)
                                {
                                    if (((double)rate.ExchangeRateValue * _Invoiceq.Total) > _elemento.Valordecimal)
                                    {
                                        GenerateAlert = true;
                                    }
                                }
                            }
                        }

                        if (GenerateAlert)
                        {
                            //se agrega la alerta
                            Alert _alert = new Alert();
                            _alert.DocumentId          = _invoice.InvoiceId;
                            _alert.DocumentName        = "FACTURA";
                            _alert.AlertName           = "Sancionados";
                            _alert.Code                = "PERSON004";
                            _alert.ActionTakenId       = 0;
                            _alert.ActionTakenName     = "";
                            _alert.IdEstado            = 0;
                            _alert.SujetaARos          = false;
                            _alert.FalsoPositivo       = false;
                            _alert.CloseDate           = DateTime.MinValue;
                            _alert.DescriptionAlert    = _invoice.InvoiceId.ToString() + " / " + _invoice.CustomerName + " / " + _invoice.Total.ToString();
                            _alert.FechaCreacion       = DateTime.Now;
                            _alert.FechaModificacion   = DateTime.Now;
                            _alert.UsuarioCreacion     = _invoice.UsuarioCreacion;
                            _alert.UsuarioModificacion = _invoice.UsuarioModificacion;
                            _context.Alert.Add(_alert);

                            //se agrega la informacion a la tabla InvoiceTransReport
                            InvoiceTransReport _report = new InvoiceTransReport();
                            _report.Amount              = _invoice.Total;
                            _report.CustomerId          = _invoice.CustomerId;
                            _report.InvoiceDate         = _invoice.InvoiceDate;
                            _report.FechaCreacion       = DateTime.Now;
                            _report.FechaModificacion   = DateTime.Now;
                            _report.UsuarioCreacion     = _invoice.UsuarioCreacion;
                            _report.UsuarioModificacion = _invoice.UsuarioModificacion;
                            _context.InvoiceTransReport.Add(_report);
                        }
                        //await _context.SaveChangesAsync();
                        foreach (var item in _Invoice.InvoiceLine)
                        {
                            item.InvoiceId = _Invoiceq.InvoiceId;
                            _context.InvoiceLine.Add(item);
                        }

                        await _context.SaveChangesAsync();

                        JournalEntryConfiguration _journalentryconfiguration = await(_context.JournalEntryConfiguration
                                                                                     .Where(q => q.TransactionId == 1)
                                                                                     .Where(q => q.BranchId == _Invoiceq.BranchId)
                                                                                     .Where(q => q.EstadoName == "Activo")
                                                                                     .Include(q => q.JournalEntryConfigurationLine)
                                                                                     ).FirstOrDefaultAsync();

                        BitacoraWrite _writejec = new BitacoraWrite(_context, new Bitacora
                        {
                            IdOperacion  = _Invoice.CustomerId,
                            DocType      = "JournalEntryConfiguration",
                            ClaseInicial =
                                Newtonsoft.Json.JsonConvert.SerializeObject(_journalentryconfiguration, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            ResultadoSerializado = Newtonsoft.Json.JsonConvert.SerializeObject(_journalentryconfiguration, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            Accion              = "InsertInvoice",
                            FechaCreacion       = DateTime.Now,
                            FechaModificacion   = DateTime.Now,
                            UsuarioCreacion     = _Invoice.UsuarioCreacion,
                            UsuarioModificacion = _Invoice.UsuarioModificacion,
                            UsuarioEjecucion    = _Invoice.UsuarioModificacion,
                        });

                        // await _context.SaveChangesAsync();

                        double sumacreditos = 0, sumadebitos = 0;
                        if (_journalentryconfiguration != null)
                        {
                            //Crear el asiento contable configurado
                            //.............................///////
                            JournalEntry _je = new JournalEntry
                            {
                                Date               = _Invoiceq.InvoiceDate,
                                Memo               = "Factura de ventas",
                                DatePosted         = _Invoiceq.InvoiceDate,
                                ModifiedDate       = DateTime.Now,
                                CreatedDate        = DateTime.Now,
                                ModifiedUser       = _Invoiceq.UsuarioModificacion,
                                CreatedUser        = _Invoiceq.UsuarioCreacion,
                                DocumentId         = _Invoiceq.InvoiceId,
                                TypeOfAdjustmentId = 65,
                                VoucherType        = 1,
                            };



                            foreach (var item in _journalentryconfiguration.JournalEntryConfigurationLine)
                            {
                                InvoiceLine _iline = new InvoiceLine();
                                _iline = _Invoiceq.InvoiceLine.Where(q => q.SubProductId == item.SubProductId).FirstOrDefault();
                                if (_iline != null || item.SubProductName.ToUpper().Contains(("Impuesto").ToUpper()))
                                {
                                    if (!item.AccountName.ToUpper().Contains(("Impuestos sobre ventas").ToUpper()) &&
                                        !item.AccountName.ToUpper().Contains(("Sobre Servicios Diversos").ToUpper()))
                                    {
                                        _iline.AccountId   = Convert.ToInt32(item.AccountId);
                                        _iline.AccountName = item.AccountName;
                                        _context.Entry(_iline).CurrentValues.SetValues((_iline));

                                        _je.JournalEntryLines.Add(new JournalEntryLine
                                        {
                                            AccountId    = Convert.ToInt32(item.AccountId),
                                            AccountName  = item.AccountName,
                                            Description  = item.AccountName,
                                            Credit       = item.DebitCredit == "Credito" ? _iline.SubTotal : 0,
                                            Debit        = item.DebitCredit == "Debito" ? _iline.SubTotal : 0,
                                            CreatedDate  = DateTime.Now,
                                            ModifiedDate = DateTime.Now,
                                            CreatedUser  = _Invoiceq.UsuarioCreacion,
                                            ModifiedUser = _Invoiceq.UsuarioModificacion,
                                            Memo         = "",
                                        });

                                        sumacreditos += item.DebitCredit == "Credito" ? _iline.SubTotal : 0;
                                        sumadebitos  += item.DebitCredit == "Debito" ? _iline.SubTotal : 0;
                                    }
                                    else
                                    {
                                        _je.JournalEntryLines.Add(new JournalEntryLine
                                        {
                                            AccountId    = Convert.ToInt32(item.AccountId),
                                            AccountName  = item.AccountName,
                                            Description  = item.AccountName,
                                            Credit       = item.DebitCredit == "Credito" ? _Invoiceq.Tax + _Invoiceq.Tax18 : 0,
                                            Debit        = item.DebitCredit == "Debito" ? _Invoiceq.Tax + _Invoiceq.Tax18 : 0,
                                            CreatedDate  = DateTime.Now,
                                            ModifiedDate = DateTime.Now,
                                            CreatedUser  = _Invoiceq.UsuarioCreacion,
                                            ModifiedUser = _Invoiceq.UsuarioModificacion,
                                            Memo         = "",
                                        });

                                        sumacreditos += item.DebitCredit == "Credito" ? _Invoiceq.Tax + _Invoiceq.Tax18 : 0;
                                        sumadebitos  += item.DebitCredit == "Debito" ? _Invoiceq.Tax + _Invoiceq.Tax18 : 0;
                                    }
                                }

                                // _context.JournalEntryLine.Add(_je);
                            }


                            if (sumacreditos != sumadebitos)
                            {
                                transaction.Rollback();
                                _logger.LogError($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}");
                                return(BadRequest($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}"));
                            }

                            _je.TotalCredit = sumacreditos;
                            _je.TotalDebit  = sumadebitos;
                            _context.JournalEntry.Add(_je);

                            await _context.SaveChangesAsync();
                        }

                        BitacoraWrite _write = new BitacoraWrite(_context, new Bitacora
                        {
                            IdOperacion  = _Invoice.CustomerId,
                            DocType      = "Invoice",
                            ClaseInicial =
                                Newtonsoft.Json.JsonConvert.SerializeObject(_Invoice, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            ResultadoSerializado = Newtonsoft.Json.JsonConvert.SerializeObject(_Invoice, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            Accion              = "Insert",
                            FechaCreacion       = DateTime.Now,
                            FechaModificacion   = DateTime.Now,
                            UsuarioCreacion     = _Invoice.UsuarioCreacion,
                            UsuarioModificacion = _Invoice.UsuarioModificacion,
                            UsuarioEjecucion    = _Invoice.UsuarioModificacion,
                        });



                        await _context.SaveChangesAsync();

                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_Invoiceq)));
        }
示例#24
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                calculaprecios();
                if ((richTextBox1.Text != "") && (textBox8.Text != "") && (textBox13.Text != "") && (comboBox3.SelectedIndex != -1) && (comboBox1.SelectedIndex != -1))
                {
                    DAO.FacturasDAO facturasdao = new EquimarFac.DAO.FacturasDAO();
                    //this.IDFactura, this.NumeroProgresivo, this.Fecha, this.Concepto, this.Subtotal, this.Iva, this.Total, this.ConceptoT);
                    facturasdao.IDFactura = int.Parse(this.Text);
                    //facturasdao.Folio = (textBox8.Text);
                    facturasdao.NumeroProgresivo = 1;
                    facturasdao.Fecha            = DateTime.Now;
                    facturasdao.Concepto         = richTextBox1.Text;
                    facturasdao.Subtotal         = decimal.Parse(textBox13.Text);
                    facturasdao.Iva   = decimal.Parse(textBox14.Text);
                    facturasdao.Total = decimal.Parse(textBox15.Text);
                    //, this.Descuento_decimal, this.MotivoDescuento_string, this.PorcentajeDescuento_decimal, this.Moneda, this.TipoDeCambio_decimal, this.FechaTipoCambio_datetime, this.UUID, this.Folio);
                    if (((checkBox3.Checked) | (checkBox4.Checked)) && textBox2.Text != "")
                    {
                        if (checkBox3.Checked)
                        {
                            //porcentaje
                            facturasdao.Descuento_decimal           = descuentopublic;
                            facturasdao.PorcentajeDescuento_decimal = descuentoporcentajepublic;
                        }

                        if (checkBox4.Checked)
                        {
                            //cantidad
                            facturasdao.Descuento_decimal           = descuentopublic;
                            facturasdao.PorcentajeDescuento_decimal = descuentoporcentajepublic;
                        }
                    }
                    else
                    {
                    }
                    facturasdao.MotivoDescuento_string = textBox3.Text;
                    facturasdao.Moneda = comboBox3.Text;
                    if (textBox4.Text != "")
                    {
                        facturasdao.TipoDeCambio_decimal = decimal.Parse(textBox4.Text);
                    }
                    else
                    {
                    }
                    //facturasdao.TipoDeCambio_decimal = decimal.Parse(textBox4.Text);
                    facturasdao.FechaTipoCambio_datetime = (dateTimePicker5.Value);
                    facturasdao.UUID  = "";
                    facturasdao.Folio = "";
                    Numalet let = new Numalet();
                    if (comboBox3.Text == "USD")
                    {
                        let.MascaraSalidaDecimal   = "00'/100 U.S.D'";
                        let.SeparadorDecimalSalida = "Dolares";
                        //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                        let.ApocoparUnoParteEntera = true;

                        facturasdao.ConceptoT = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                        //Son: un mil ciento veintiún pesos 24/100 M.N.
                    }
                    else
                    {
                        let.MascaraSalidaDecimal   = "00'/100 M.N'";
                        let.SeparadorDecimalSalida = "Pesos";
                        //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                        let.ApocoparUnoParteEntera = true;

                        facturasdao.ConceptoT = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                        //Son: un mil ciento veintiún pesos 24/100 M.N.
                    }
                    string resultado = facturasdao.actualiza_notacredito();
                    if (resultado != "Correcto")
                    {
                        MessageBox.Show(resultado);
                    }
                    else
                    {
                        //facturasgui.actualizagrid();
                        //this.Close();
                        carganotasgrid();
                    }
                }
                else
                {
                    MessageBox.Show("Verifique su informacion por datos faltantes");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#25
0
 public static String ToCardinal(String Numero)
 {
     return(Numalet.ToCardinal(Numero, CultureInfo.CurrentCulture));
 }
示例#26
0
        public void Pagares2(string _correlativo, string _cc)
        {
            string[] arrayLogin = HttpContext.Current.User.Identity.Name.Split('¬');
            //Session["cronogramaya"] = "6857.5|6142.5|0|11/2/2018¬89.57|24|10|Mensual^Inicial nro: 1|11/2/2018|S/. 6857.5|S/. 715|S/. 0|S/. 715¬Inicial nro: 2|12/2/2018|S/. 6142.5|S/. 800|S/. 0|S/. 800¬Inicial nro: 3|1/2/2018|S/. 5342.5|S/. 1000|S/. 0|S/. 1000¬Cuota nro: 1|11/1/2018|S/. 4342.5|S/. 164.89|S/. 34.63|S/. 199.52¬Cuota nro: 2|12/1/2018|S/. 4177.61|S/. 166.21|S/. 33.31|S/. 199.52¬Cuota nro: 3|1/1/2019|S/. 4011.4|S/. 167.53|S/. 31.99|S/. 199.52¬Cuota nro: 4|2/1/2019|S/. 3843.87|S/. 168.87|S/. 30.65|S/. 199.52¬Cuota nro: 5|3/1/2019|S/. 3675|S/. 170.22|S/. 29.3|S/. 199.52¬Cuota nro: 6|4/1/2019|S/. 3504.78|S/. 171.57|S/. 27.95|S/. 199.52¬Cuota nro: 7|5/1/2019|S/. 3333.21|S/. 172.94|S/. 26.58|S/. 199.52¬Cuota nro: 8|6/1/2019|S/. 3160.27|S/. 174.32|S/. 25.2|S/. 199.52¬Cuota nro: 9|7/1/2019|S/. 2985.95|S/. 175.71|S/. 23.81|S/. 199.52¬Cuota nro: 10|8/1/2019|S/. 2810.24|S/. 177.11|S/. 22.41|S/. 199.52¬Cuota nro: 11|9/1/2019|S/. 2633.13|S/. 178.52|S/. 21|S/. 199.52¬Cuota nro: 12|10/1/2019|S/. 2454.61|S/. 179.95|S/. 19.57|S/. 199.52¬Cuota nro: 13|11/1/2019|S/. 2274.66|S/. 181.38|S/. 18.14|S/. 199.52¬Cuota nro: 14|12/1/2019|S/. 2093.28|S/. 182.83|S/. 16.69|S/. 199.52¬Cuota nro: 15|1/1/2020|S/. 1910.45|S/. 184.29|S/. 15.23|S/. 199.52¬Cuota nro: 16|2/1/2020|S/. 1726.16|S/. 185.76|S/. 13.76|S/. 199.52¬Cuota nro: 17|3/1/2020|S/. 1540.4|S/. 187.24|S/. 12.28|S/. 199.52¬Cuota nro: 18|4/1/2020|S/. 1353.16|S/. 188.73|S/. 10.79|S/. 199.52¬Cuota nro: 19|5/1/2020|S/. 1164.43|S/. 190.24|S/. 9.29|S/. 199.52¬Cuota nro: 20|6/1/2020|S/. 974.19|S/. 191.75|S/. 7.77|S/. 199.52¬Cuota nro: 21|7/1/2020|S/. 782.44|S/. 193.28|S/. 6.24|S/. 199.52¬Cuota nro: 22|8/1/2020|S/. 589.16|S/. 194.82|S/. 4.7|S/. 199.52¬Cuota nro: 23|9/1/2020|S/. 394.34|S/. 196.38|S/. 3.14|S/. 199.52¬Cuota nro: 24|10/1/2020|S/. 197.96|S/. 197.94|S/. 1.58|S/. 199.52¬~446.01~4788.5";
            //Session["datos"] = "Jorge Samir|Pazo Torres|birthDay|M|DocumentType|73680055$NombreC|ApellidoC|1|313231c$bankName|nombreBankAccount|TypeAccount|nroAccount|nroTaxer|SocialReason|fiscalAdress|UserType$email|nroCell|nroCell2|country|State|City|Calle comercio 715 El Agustino";
            //Session["carrito"] = "6000.00|descripcionDB|60|9750.00|3.25|10|TOP";
            string[] datos      = Session["datos"].ToString().Split('$');
            string[] carrito    = Session["carrito"].ToString().Split('|');
            string[] cronograma = Session["cronogramaYa"].ToString().Split('|');

            string[] arrayperson    = datos[0].Split('|');
            string[] arraycontacto  = datos[3].Split('|');
            string   totaldolares   = cronograma[0];
            string   primeracuota   = carrito[3];
            string   tipocambio     = carrito[4];
            decimal  typeChange     = decimal.Parse(tipocambio);
            string   numerodecuotas = carrito[2];
            string   codemem        = carrito[6];


            Numalet     numalet = new Numalet();
            MyFunctions mf      = new MyFunctions();
            MyConstants mc      = new MyConstants();


            //string fechaActual = DateTime.Now.ToLongDateString();
            var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

            string fechaActual = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];


            var bankAccount = mc.BankAccount;

            string codigo    = "";
            string nombre    = "";
            string dni       = "";
            string domicilio = "";
            string username  = "";


            nombre   = arrayperson[0].ToUpper() + " " + arrayperson[1].ToUpper();
            dni      = arrayperson[5];
            username = (arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni).ToUpper();

            dni = arrayperson[5];
            string userName = (arrayperson[0].Substring(0, 1) + arrayperson[1].Substring(0, 1) + dni).ToUpper();

            domicilio = arraycontacto[6];
            string distrito = arraycontacto[5];
            string correo   = arraycontacto[0];
            string telefono = arraycontacto[1];

            string fecha = DateTime.Now.ToString("dd-MM-yyyy");

            string[] array1   = Session["cronogramaYa"].ToString().Split('^');
            string[] datosMem = array1[0].Split('|');
            string[] array2   = array1[1].Split('~');

            string[] cuotas = array2[0].Split('¬');

            decimal totalpagar = 0, interestotal = 0, importefinanciado = 0, porcefinanciado = 0, valorcuotas = 0;
            int     ncuotas = 0, interruptor = 0;
            string  fechacuotas = "";

            List <Pagare> listPagare = new List <Pagare>();

            for (int i = 0; i < cuotas.Length - 1; i++)
            {
                var fila = cuotas[i].Split('|');
                if (fila[0].Substring(0, 7) != "Inicial")
                {
                    if (fila[0].Substring(0, 7) != "Upgrade")
                    {
                        totalpagar   += decimal.Parse(fila[5].Replace("S/.", ""));
                        interestotal += decimal.Parse(fila[4].Replace("S/.", ""));
                        ncuotas++;

                        if (interruptor != 1)
                        {
                            interruptor       = 1;
                            importefinanciado = decimal.Parse(fila[2].Replace("S/.", ""));
                            fechacuotas       = DateTime.Parse(fila[1]).ToString("dd/MM/yyyy");
                            valorcuotas       = decimal.Parse(fila[5].Replace("S/.", ""));
                        }
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        listPagare.Add(new Pagare
                        {
                            Id               = 1,
                            Codigo           = codigo,
                            NombreCompleto   = nombre,
                            Dni              = dni,
                            Domicilio        = domicilio,
                            Fecha            = fechaActual,
                            FechaCuotas      = DateTime.Parse(fila[1]).ToString("dd/MM/yyyy"),
                            MontoSoles       = decimal.Parse(fila[5].Replace("S/.", "")),
                            MontoSolesLetras = numalet.ToCustomCardinal(decimal.Parse(mf.GetAmountCurrency(fila[5].Replace("S/.", ""), _cc, typeChange))),
                            NCuotas          = 1,
                            ValorCuotas      = decimal.Parse(fila[5].Replace("S/.", ""))
                        });
                    }
                }
            }
            porcefinanciado = (importefinanciado * 100) / decimal.Parse(datosMem[0]);

            listPagare.Add(new Pagare
            {
                Id               = 1,
                Codigo           = codigo,
                NombreCompleto   = nombre,
                Dni              = dni,
                Domicilio        = domicilio,
                Fecha            = fechaActual,
                FechaCuotas      = fechacuotas,
                MontoSoles       = importefinanciado,
                MontoSolesLetras = numalet.ToCustomCardinal(double.Parse(mf.GetAmountCurrency(importefinanciado.ToString(), _cc, typeChange))),
                NCuotas          = ncuotas,
                ValorCuotas      = valorcuotas
            });


            using (Document document = new Document(PageSize.A4, 10, 10, 10, 10))
            {
                string datecur = DateTime.Now.ToString("yyyy;MM;dd;hh;mm;ss;fff");
                string ruta    = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/") + "PAG" + username + _correlativo + ".pdf";
                this.RutaUrlPagare = "~/Resources/PoliticsPdf/" + "PAG" + username + _correlativo + ".pdf";
                string destin = HttpContext.Current.Server.MapPath("~/Resources/trash/") + "PAG" + username + _correlativo + datecur + ".pdf";
                if (File.Exists(ruta))
                {
                    File.Move(ruta, destin);
                }

                FileStream stream = new FileStream(ruta, FileMode.Create);
                PdfWriter.GetInstance(document, stream);

                document.Open();
                string cadenfinal = string.Empty;

                for (int i = 0; i < listPagare.Count; i++)
                {
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 12pt;font-weight: bold;'>PAGARÉ CODIGO: " + userName.ToUpper() + "-" + (i + 1).ToString() + "</div>";
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;font-weight: bold;'>POR UN VALOR DE( " + listPagare[i].MontoSolesLetras.ToUpper() + " " + _cc + " )</div>";
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;font-weight: bold;'>( " + mf.GetAmountCurrency(listPagare[i].MontoSoles.ToString(), _cc, typeChange) + " " + _cc + " )ESTE VALOR ES EL SALDO A FINANCIAR</div>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Yo <b>" + listPagare[i].NombreCompleto + "</b> identificado(a) con DNI Nº <b>" + listPagare[i].Dni + "</b> con domicilio y residencia en <b>" + listPagare[i].Domicilio + "</b>.</p>" +
                                  "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Me comprometo a pagar incondicionalmente a VALLE ENCANTADO S.A.C " +
                                  "la suma de <b>" + listPagare[i].MontoSolesLetras + " " + _cc + " ( " + mf.GetAmountCurrency(listPagare[i].MontoSoles.ToString(), _cc, typeChange) + " " + _cc + " ) </b> pagadero en <b>" + listPagare[i].NCuotas + "</b> cuotas mensuales y consecutivas con vencimiento la primera " +
                                  "de ella el día <b>" + listPagare[i].FechaCuotas + "</b>, por valor de <b>( " + mf.GetAmountCurrency(listPagare[i].ValorCuotas.ToString(), _cc, typeChange) + " " + _cc + ")</b>.El pago de dichas cuotas se realizará en Soles a razón del cambio oficial vigente" +
                                  " a la fecha en que se efectúe éste. En caso de mora y mientras ella subsista pagaré intereses moratorios a la tasa máxima establecida para" +
                                  " el periodo correspondiente. De igual manera me obligo a pagar todos los gastos y costos de la cobranza judicial. </p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En el evento en que el deudor no pague en el plazo" +
                                  " estipulado una o más cuotas, el tenedor de este título podrá declarar vencidos todos los plazos de esta obligación y pedir su inmediato" +
                                  " pago total o el pago del saldo.</p>";

                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>También acepto que <b>VALLE ENCANTADO S.A.C</b>, declare de plazo vencido la obligación a la que se refiere este pagaré y exigir su pago total en el evento en que sea perseguido judicialmente. El recibo de abono de parciales no implica novación y cualquier pago que se efectúe se imputará primero a gastos, penalidades, y por último a capital. El suscriptor de este pagaré hace constatar que la obligación de pagarla indivisiblemente y solidariamente subsiste en caso de prórroga o prórrogas o de cualquier modificación a lo estipulado. El deudor declara que la suma que debe conforme a este pagaré, no estará sujeta ni a deducción ni a descuentos de cualquier naturaleza, incluyendo sin limitación cualquier impuesto que pueda gravar su pago, por lo tanto, en caso de existir alguna de estas deducciones o descuentos, el deudor deberá aumentar la suma a pagar de tal manera que el tenedor reciba siempre el valor estipulado del pagaré. El deudor acepta desde ahora el endoso, cesión o transferencia que de este pagaré a VALLE ENCANTADO S.A.C. todos los gastos e impuestos relacionados con la suscripción de este pagaré serán por cuenta del deudor.</p>";
                    cadenfinal += $"<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Todos los pagos que deban hacerse según este pagaré serán hechos exclusivamente en Soles, a la<b> Cuenta Recaudadora Soles BCP N° {bankAccount}</b>, en su oficina central ubicada en Av. Guardia Civil 1321 oficina 602 – Surquillo o en Ribera del Río Club Resort ubicada en Mz. B Lt. 72. Tercera Etapa - Cieneguilla.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Todos los cálculos de intereses se efectuarán sobre la base de un año de trescientos sesenta (360) días, en cada caso por el número de días efectivamente transcurridos (incluyendo el primer día, pero excluyendo el último día) durante el pazo por el cual deban pagarse tale intereses. Si cualquiera de las fechas de pago de principal o intereses antes indicadas coincidiera con un día no hábil, se entenderá que el pago respectivo deberá ser efectuado el día hábil inmediatamente siguiente." +
                                  "Cualquier referencia en este pagaré al agente deberá entenderse efectuada a cualquier tenedor del mismo, sea que lo adquiera por endoso o de otro modo.</p>";

                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En caso de mora, no será necesario requerimiento alguno para que el Cliente incurra en la misma, de acuerdo a lo establecido en el artículo 1333 inciso 1 del Código Civil Peruano. En dicho caso, durante todo el periodo de incumplimiento el cliente pagara a una tasa equivalente al máximo de interés permitido por la ley, por concepto de interés moratorio.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>De conformidad con lo establecido por el artículo 158.2 concordante con el artículo 52° de la Ley de Títulos Valores, este pagaré no requerirá ser protestado por la falta de pago de cualquiera de las cuotas para ejercitar las acciones derivadas del mismo.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Adicionalmente, el cliente se obliga incondicionalmente a pagar al Agente todos los gastos en que éste incurra en razón de su incumplimiento, obligándose a pagar sobre éstos el mismo interés moratorio pactado en este pagaré.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Asimismo, el cliente acepta las renovaciones y prórrogas de vencimiento de este pagaré que el agente considere conveniente efectuar, ya sea por su importe parcial o total, aun cuando no hayan sido comunicadas al cliente. Dichas modificaciones serán anotadas en este mismo instrumento o en hoja anexa, sin que sea necesaria la suscripción de tal instrumento.</p>";

                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Este pagare se devolverá a su cancelación total. Queda expresamente establecido que el domicilio del cliente es <b>" + listPagare[i].Domicilio + " - Lima Perú</b>, lugar a donde se dirigirán todas las comunicaciones y notificaciones derivadas de este pagaré.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Queda establecido que las obligaciones contenidas en este pagaré, constituyendo el presente acuerdo pacto en contrario a lo dispuesto por el artículo 1233° del Código Civil.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Este pagaré se regirá bajo las leyes de la República del Perú.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>Cualquier acción o procedimiento legal relacionado con y derivado del presente pagaré podrá ser iniciado ante los órganos judiciales del Cercado de Lima, Lima, Perú. El cliente renuncia a la jurisdicción de cualquier otro tribunal que pudiere corresponderle por cualquier otra razón.</p>";
                    cadenfinal += "<p style='text-align: justify;font-family:cambria;font-size: 10pt;line-height: 13px;'>En constancia de lo anterior, se firma el presente pagaré el día <b>" + listPagare[i].Fecha + "</b> en la ciudad de Lima,El Deudor.</p>";

                    cadenfinal += "<br /><br /><br /><br />";
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>______________________________</div>";
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>FIRMA</div>";
                    cadenfinal += "<div style='text-align: center;font-family:cambria;font-size: 10pt;line-height: 13px;'>DNI:<b>" + listPagare[i].Dni + "</b></div>";
                    if (listPagare[i].Domicilio.Length < 30)
                    {
                        cadenfinal += "<br />";
                    }
                    cadenfinal += "<br />";
                }
                StyleSheet styleSheet = new StyleSheet();

                Dictionary <string, string> stylep = new Dictionary <string, string>()
                {
                    { "font-family", "Calibri" },
                    { "text-align", "justify" },
                    { "line-height", "normal" },
                    { "font-size", "10pt" }
                };

                styleSheet.ApplyStyle("p", stylep);


                var parsehtml = HTMLWorker.ParseToList(new StringReader(cadenfinal), styleSheet);

                foreach (var htmlElement in parsehtml)
                {
                    document.Add(htmlElement as IElement);
                }
                document.Close();
            }
        }
示例#27
0
        public override void MostrarDataRegistroSel()
        {
            double capital = 0, interes = 0, demora = 0, otros = 0;
            string prestamoId = "0";
            int    diasAtrazo = 0;

            try
            {
                base.MostrarDataRegistroSel();
                prestamoId          = objUtil.GetAsString("Prestamo_Id", drRegistroSel);
                lblDocumentoId.Text = prestamoId.PadLeft(7, '0');
                SetValorEncabezado("Documento_Id", prestamoId);

                lblNombreCliente.Text = objUtil.GetAsString("ANombre", drRegistroSel);

                lblTipoDocumento.Text = objUtil.GetAsString("Descripcion_Tipo_Garantia", drRegistroSel);
                lblFecha.Text         = objUtil.GetDateAsString("Fecha", drRegistroSel);
                lblFechaPagoAnt.Text  = objUtil.GetDateAsString("Fecha_Ultimo_Abono", drRegistroSel);
                lblFechaProxPago.Text = objUtil.GetDateAsString("Fecha_Proximo_Pago", drRegistroSel);
                lblFechaVence.Text    = objUtil.GetDateAsString("Fecha_Termino", drRegistroSel);
                diasAtrazo            = objUtil.GetAsInt("Dias_Atrazo", drRegistroSel);
                lblDiasAtrazo.Text    = diasAtrazo.ToString("N0");

                capital            = objUtil.GetAsDouble("Capital_Pendiente", drRegistroSel);
                interes            = objUtil.GetAsDouble("Interes_Pendiente", drRegistroSel);
                demora             = objUtil.GetAsDouble("Demora_Pendiente", drRegistroSel);
                otros              = objUtil.GetAsDouble("Otros_Pendiente", drRegistroSel);
                totalVP            = objUtil.GetAsDouble("Total_VP", drRegistroSel);
                montoCuota         = objUtil.GetAsDouble("Monto_Cuota", drRegistroSel);
                lblMontoCuota.Text = montoCuota.ToString("N2");

                saldo = capital + interes + demora + otros;

                lblCapital.Text          = capital.ToString("N2");
                lblInteres.Text          = interes.ToString("N2");
                lblDemora.Text           = demora.ToString("N2");
                lblOtros.Text            = otros.ToString("N2");
                lblBalancePendiente.Text = saldo.ToString("N2");
                lblMontoVP.Text          = totalVP.ToString("N2");

                rdbPonerseAldia.Enabled = (totalVP > 0);
                if (totalVP > 0)
                {
                    toolTip1.SetToolTip(rdbPonerseAldia, totalVP.ToString("N2") + " " + Numalet.ToCardinal(totalVP).ToUpper());
                }
                toolTip1.SetToolTip(rdbSaldar, saldo.ToString("N2") + " " + Numalet.ToCardinal(saldo).ToUpper());

                if (saldo < montoCuota)
                {
                    montoCuota        = saldo;
                    rdbSaldar.Checked = true;
                }


                SetValorEncabezado("Tipo_NCF", drRegistroSel["Tipo_NCF"].ToString());
                SetValorEncabezado("CedulaRNC", drRegistroSel["CedulaRNC"].ToString());
                SetValorEncabezado("Entidad_Id", drRegistroSel["Entidad_Id"].ToString());
                SetValorEncabezado("Capital_PAnterior", drRegistroSel["Capital_Pendiente"].ToString());



                rdbPonerseAldia.Checked = false;
                rdbSaldar.Checked       = false;
                rdbAbono.Checked        = true;
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
                this.Close();
            }
        }
        public async Task <ActionResult <VendorInvoice> > Insert([FromBody] VendorInvoice pVendorInvoice)
        {
            VendorInvoice _VendorInvoiceq = new VendorInvoice();

            _VendorInvoiceq = pVendorInvoice;
            using (var transaction = _context.Database.BeginTransaction())
            {
                try
                {
                    _VendorInvoiceq.PurchaseOrderId = null;
                    //_VendorInvoiceq.Sucursal = await _context.Branch.Where(q => q.BranchId == _VendorInvoiceq.BranchId).Select(q => q.BranchCode).FirstOrDefaultAsync();
                    Numalet let;
                    let = new Numalet();
                    let.SeparadorDecimalSalida  = "Lempiras";
                    let.MascaraSalidaDecimal    = "00/100 ";
                    let.ApocoparUnoParteEntera  = true;
                    _VendorInvoiceq.TotalLetras = let.ToCustomCardinal((_VendorInvoiceq.Total)).ToUpper();

                    _context.VendorInvoice.Add(_VendorInvoiceq);
                    //await _context.SaveChangesAsync();

                    JournalEntry _je = new JournalEntry
                    {
                        Date         = _VendorInvoiceq.VendorInvoiceDate,
                        Memo         = "Factura de Compra a Proveedores",
                        DatePosted   = _VendorInvoiceq.VendorInvoiceDate,
                        ModifiedDate = DateTime.Now,
                        CreatedDate  = DateTime.Now,
                        ModifiedUser = _VendorInvoiceq.UsuarioModificacion,
                        CreatedUser  = _VendorInvoiceq.UsuarioCreacion,
                        DocumentId   = _VendorInvoiceq.VendorInvoiceId,
                    };

                    Accounting account = await _context.Accounting.Where(acc => acc.AccountId == _VendorInvoiceq.AccountId).FirstOrDefaultAsync();

                    _je.JournalEntryLines.Add(new JournalEntryLine
                    {
                        AccountId = Convert.ToInt32(_VendorInvoiceq.AccountId),
                        //Description = _VendorInvoiceq.Account.AccountName,
                        Description  = account.AccountName,
                        Credit       = 0,
                        Debit        = _VendorInvoiceq.Total,
                        CreatedDate  = DateTime.Now,
                        ModifiedDate = DateTime.Now,
                        CreatedUser  = _VendorInvoiceq.UsuarioCreacion,
                        ModifiedUser = _VendorInvoiceq.UsuarioModificacion,
                        Memo         = "",
                    });
                    foreach (var item in _VendorInvoiceq.VendorInvoiceLine)
                    {
                        account = await _context.Accounting.Where(acc => acc.AccountId == _VendorInvoiceq.AccountId).FirstOrDefaultAsync();

                        item.VendorInvoiceId = _VendorInvoiceq.VendorInvoiceId;
                        _context.VendorInvoiceLine.Add(item);
                        _je.JournalEntryLines.Add(new JournalEntryLine
                        {
                            AccountId    = Convert.ToInt32(item.AccountId),
                            Description  = account.AccountName,
                            Credit       = item.Total,
                            Debit        = 0,
                            CreatedDate  = DateTime.Now,
                            ModifiedDate = DateTime.Now,
                            CreatedUser  = _VendorInvoiceq.UsuarioCreacion,
                            ModifiedUser = _VendorInvoiceq.UsuarioModificacion,
                            Memo         = "",
                        });
                    }

                    await _context.SaveChangesAsync();

                    double sumacreditos = 0, sumadebitos = 0;
                    if (sumacreditos != sumadebitos)
                    {
                        transaction.Rollback();
                        _logger.LogError($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}");
                        return(BadRequest($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}"));
                    }

                    _je.TotalCredit = sumacreditos;
                    _je.TotalDebit  = sumadebitos;
                    _context.JournalEntry.Add(_je);

                    await _context.SaveChangesAsync();

                    BitacoraWrite _write = new BitacoraWrite(_context, new Bitacora
                    {
                        IdOperacion  = 4,    ///////Falta definir los Id de las Operaciones
                        DocType      = "VendorInvoice",
                        ClaseInicial =
                            Newtonsoft.Json.JsonConvert.SerializeObject(_VendorInvoiceq, new JsonSerializerSettings {
                            ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                        }),
                        ResultadoSerializado = Newtonsoft.Json.JsonConvert.SerializeObject(_VendorInvoiceq, new JsonSerializerSettings {
                            ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                        }),
                        Accion              = "Insert",
                        FechaCreacion       = DateTime.Now,
                        FechaModificacion   = DateTime.Now,
                        UsuarioCreacion     = _VendorInvoiceq.UsuarioCreacion,
                        UsuarioModificacion = _VendorInvoiceq.UsuarioModificacion,
                        UsuarioEjecucion    = _VendorInvoiceq.UsuarioModificacion,
                    });
                    await _context.SaveChangesAsync();

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                    throw ex;
                }
            }


            return(await Task.Run(() => Ok(_VendorInvoiceq)));
        }
示例#29
0
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                DAO.FacturasDAO facturasdao = new FacturasDAO();
                facturasdao.IDFactura = int.Parse(lbl_idfactura.Text);

                Numalet let = new Numalet();
                if (comboBox3.Text == "USD")
                {
                    let.MascaraSalidaDecimal   = "00'/100 USD'";
                    let.SeparadorDecimalSalida = "Dolares";
                    //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                    let.ApocoparUnoParteEntera = true;
                    facturasdao.TotalLetras    = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                    //Son: un mil ciento veintiún pesos 24/100 M.N.
                }
                else
                {
                    let.MascaraSalidaDecimal   = "00'/100 MXN'";
                    let.SeparadorDecimalSalida = "Pesos";
                    //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                    let.ApocoparUnoParteEntera = true;
                    facturasdao.TotalLetras    = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                    //Son: un mil ciento veintiún pesos 24/100 M.N.
                }
                //this.ClaveCFDI, this.formaDePago, this.metodoDePago, this.descuento, this.porcentajeDescuento, this.motivodescuento, this.tipodecambio,
                //this.fechatipodecambio, this.totalImpuestosretenidos, this.totalimpuestostrasladados, this.LugarExpedicion);


                facturasdao.formaDePago = "Pago en una sola exhibición";
                if (textBox16.Text != "")
                {
                    facturasdao.Descuento_decimal           = ((decimal.Parse(textBox16.Text) * decimal.Parse(textBox13.Text)) / ((decimal.Parse("100"))));
                    facturasdao.PorcentajeDescuento_decimal = int.Parse(textBox16.Text);
                    facturasdao.Subtotal = decimal.Parse(textBox13.Text);
                    decimal ivadespuesdescuento      = (decimal.Parse(textBox13.Text) - ((decimal.Parse(textBox16.Text) * decimal.Parse(textBox13.Text)) / ((decimal.Parse("100"))))) * decimal.Parse("0.16");
                    decimal subtotaldespuesdescuento = decimal.Parse(textBox13.Text) - ((decimal.Parse(textBox16.Text) * decimal.Parse(textBox13.Text)) / ((decimal.Parse("100"))));
                    facturasdao.Iva   = ivadespuesdescuento;
                    facturasdao.Total = subtotaldespuesdescuento + ivadespuesdescuento;
                }
                else
                {
                    facturasdao.descuento = "";
                    //facturasdao.PorcentajeDescuento_decimal = int.Parse(textBox16.Text);
                    facturasdao.Subtotal = decimal.Parse(textBox13.Text);
                    facturasdao.Iva      = decimal.Parse(textBox14.Text);
                    facturasdao.Total    = decimal.Parse(textBox15.Text);
                }

                facturasdao.motivodescuento = textBox17.Text;

                facturasdao.totalImpuestosretenidos   = "";
                facturasdao.totalimpuestostrasladados = textBox14.Text;
                facturasdao.LugarExpedicion           = "Merida, Yucatan";
                string resultado = facturasdao.actualizafacturatermina();
                if (resultado != "Correcto")
                {
                    MessageBox.Show(resultado);
                }
                else
                {
                    facturasdao.facturaimpresa = "";
                    facturasdao.ClaveCFDI      = "";
                    resultado = facturasdao.insertanumfacturaimpresa();
                    if (resultado != "Correcto")
                    {
                        MessageBox.Show(resultado);
                    }
                    else
                    {
                        string resultado2 = descargainventarios();
                        if (resultado2 == "Correcto")
                        {
                            MessageBox.Show("Correcto");
                            GUI.CatalogosForms.Facturas facturasgui = new Facturas();
                            facturasgui.MdiParent = this.MdiParent;
                            facturasgui.Show();

                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show(resultado2);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Hubo algun error en la informacion " + ex);
            }
        }
示例#30
0
        protected void PrintWaterIntake(int Id)
        {
            var months = new List <string>
            {
                "ENERO",
                "FEBRERO",
                "MARZO",
                "ABRIL",
                "MAYO",
                "JUNIO",
                "JULIO",
                "AGOSTO",
                "SEPTIEMBRE",
                "OCTUBRE",
                "NOVIEMBRE",
                "DICIEMBRE"
            };

            var p = new PrintDocument();

            p.PrintPage += delegate(object sender1, PrintPageEventArgs e1)
            {
                var line = string.Empty;
                for (int i = 0; i < 81; i++)
                {
                    line += "_";
                }

                var line2 = string.Empty;
                for (int i = 0; i < 125; i++)
                {
                    line2 += " - ";
                }

                var font     = "Times New Roman";
                var brush    = new SolidBrush(Color.Black);
                var brushTwo = new SolidBrush(Color.LightGray);

                var brushRed = new SolidBrush(Color.Red);

                Font titleFont    = new Font(font, 18, FontStyle.Bold),
                     titleSubFont = new Font(font, 16, FontStyle.Bold),
                     f14          = new Font(font, 14, FontStyle.Bold),
                     f11          = new Font(font, 11),
                     f10          = new Font(font, 10),
                     f09          = new Font(font, 09),
                     f08          = new Font(font, 08),
                     f06          = new Font(font, 06);

                var pen = new Pen(Brushes.Black);
                pen.Width = 0.8F;

                var picture1 = new posb.Config().GetImage("Voucher", 1);
                var picture2 = new posb.Config().GetImage("Voucher", 2);
                var picture3 = new posb.Config().GetImage("Voucher", 3);
                var imageCom = new Bitmap(new MemoryStream(picture1));
                var image    = new Bitmap(new MemoryStream(picture2));
                var sicap    = new Bitmap(new MemoryStream(picture3));

                using (posb.Payment payment = new posb.Payment
                {
                    Id = Id
                }
                       .WaterIntakePrint())
                {
                    var total = new Numalet().Convert(String.Format("{0:0.00}", payment.Amount));

                    for (int i = 0; i <= 1; i++)
                    {
                        var copy = i * 530;

                        e1.Graphics.DrawImage(imageCom, 20, 7 + copy, 90, 110);

                        e1.Graphics.DrawString("COMITÉ DE AGUA POTABLE", titleFont, brush, 240, 40 + copy);
                        e1.Graphics.DrawString("SAN DIEGO TLAILOTLACAN", titleFont, brush, 240, 65 + copy);
                        e1.Graphics.DrawImage(image, 760, 37 + copy, 60, 80);

                        e1.Graphics.FillRectangle(brush, new Rectangle(20, 106 + copy, 795, 6));
                        e1.Graphics.DrawRectangle(pen, new Rectangle(20, 112 + copy, 795, 30));
                        e1.Graphics.DrawString("RECIBO OFICIAL DE INGRESOS", titleSubFont, brush, 30, 115 + copy);

                        e1.Graphics.DrawString("FOLIO", titleSubFont, brush, 550, 115 + copy);
                        e1.Graphics.DrawString("N° T-" + payment.Folio.PadLeft(10, '0'), titleSubFont, brushRed, 630, 115 + copy);

                        e1.Graphics.DrawRectangle(pen, new Rectangle(20, 158 + copy, 795, 127));
                        e1.Graphics.DrawRectangle(pen, new Rectangle(20, 158 + copy, 222, 127));

                        e1.Graphics.DrawString("RECIBI DEL(A) SR(A)", f14, brush, 30, 170 + copy);
                        e1.Graphics.DrawString(payment.Propietario, f14, brush, 250, 170 + copy);
                        e1.Graphics.DrawString(line, f14, brush, 17, 170 + copy);

                        e1.Graphics.DrawString("CANTIDAD", f14, brush, 30, 200 + copy);
                        e1.Graphics.DrawString("$" + String.Format("{0:0.00}", payment.Amount) + "   " + total, f14, brush, 250, 200 + copy);
                        e1.Graphics.DrawString(line, f14, brush, 17, 200 + copy);

                        e1.Graphics.DrawString("CONCEPTO", f14, brush, 30, 230 + copy);
                        e1.Graphics.DrawString("Pago por alta de toma de agua", f14, brush, 250, 230 + copy);
                        e1.Graphics.DrawString(line, f14, brush, 17, 230 + copy);

                        e1.Graphics.DrawString("DIRECCIÓN", f14, brush, 30, 260 + copy);
                        e1.Graphics.DrawString(payment.Direccion + "  [" + payment.Type + "]", f14, brush, 250, 260 + copy);

                        e1.Graphics.FillRectangle(brushTwo, new Rectangle(20, 299 + copy, 795, 27));
                        e1.Graphics.DrawRectangle(pen, new Rectangle(20, 299 + copy, 795, 27));

                        e1.Graphics.DrawString("DESCRIPCIÓN DEL PAGO", titleSubFont, brush, 280, 300 + copy);
                        e1.Graphics.DrawString("Pago por alta de toma de agua ubicada en:" + payment.Direccion, f10, brush, 25, 332 + copy);

                        e1.Graphics.DrawRectangle(pen, new Rectangle(20, 326 + copy, 795, 27));

                        e1.Graphics.DrawString("SAN DIEGO TEXCOCO ESTADO DE MEXICO A " + payment.CreationDate.Value.ToString("dd") + " DE " + months[int.Parse(payment.CreationDate.Value.ToString("MM")) - 1] + " DE " + payment.CreationDate.Value.ToString("yyyy"), f10, brush, 340, 360 + copy);

                        using (var addNames = new posb.Config())
                        {
                            var showNames = addNames.AltaAddNames();

                            if (showNames)
                            {
                                e1.Graphics.DrawString("_________________________________", f09, brush, 100, 430 + copy);
                                e1.Graphics.DrawString("TESORERO(A): " + payment.Tesorero, f08, brush, 100, 450 + copy);
                                //e1.Graphics.DrawString("", f08, brush, 163, 470 + copy);

                                e1.Graphics.DrawString("_________________________________", f09, brush, 500, 430 + copy);
                                e1.Graphics.DrawString("PRESIDENTE(A): " + payment.Presidente, f08, brush, 500, 450 + copy);
                                //e1.Graphics.DrawString("VO.BO.  DE COMITE", f08, brush, 520, 470 + copy);
                            }
                            else
                            {
                                e1.Graphics.DrawString("_________________________________", f09, brush, 100, 430 + copy);
                                e1.Graphics.DrawString("TESORERO(A)", f08, brush, 170, 450 + copy);
                                //e1.Graphics.DrawString("", f08, brush, 163, 470 + copy);

                                e1.Graphics.DrawString("_________________________________", f09, brush, 500, 430 + copy);
                                e1.Graphics.DrawString("PRESIDENTE(A)", f08, brush, 565, 450 + copy);
                                //e1.Graphics.DrawString("VO.BO.  DE COMITE", f08, brush, 520, 470 + copy);
                            }
                        }

                        e1.Graphics.DrawImage(sicap, 403, 430 + copy, 40, 50);

                        e1.Graphics.DrawString("SICAP V1.0.0", f06, brush, 397, 480 + copy);

                        e1.Graphics.DrawString("Impresión " + (i + 1) + " - " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"), f08, brush, 610, 495 + copy);

                        if (i.Equals(0))
                        {
                            e1.Graphics.DrawString(line2, f06, brush, 0, 525 + copy);
                        }
                    }
                }

                pen.Dispose();
            };

            try
            {
                using (var printer = new posb.Config())
                {
                    p.PrinterSettings.PrinterName = printer.Printer();
                }

                p.Print();
            }
            catch (Exception ex)
            {
                this.Alert("Ocurrió un error al intentar imprimir el ticket. Descripcion: " + ex.Message, eForm.TypeError.Error);
            }

            return;
        }
        public async Task <ActionResult <InsuranceEndorsement> > Insert([FromBody] InsuranceEndorsement pInsuranceEndorsement)
        {
            InsuranceEndorsement _InsuranceEndorsementq = new InsuranceEndorsement();

            _InsuranceEndorsementq = pInsuranceEndorsement;
            using (var transaction = _context.Database.BeginTransaction())
            {
                try
                {
                    Numalet let;
                    let = new Numalet();
                    let.SeparadorDecimalSalida = "Lempiras";
                    let.MascaraSalidaDecimal   = "00/100 ";
                    let.ApocoparUnoParteEntera = true;


                    _context.InsuranceEndorsement.Add(_InsuranceEndorsementq);
                    //await _context.SaveChangesAsync();

                    JournalEntry _je = new JournalEntry
                    {
                        Date         = _InsuranceEndorsementq.DateGenerated,
                        Memo         = "Factura de Compra a Proveedores",
                        DatePosted   = _InsuranceEndorsementq.DateGenerated,
                        ModifiedDate = DateTime.Now,
                        CreatedDate  = DateTime.Now,
                        ModifiedUser = _InsuranceEndorsementq.UsuarioModificacion,
                        CreatedUser  = _InsuranceEndorsementq.UsuarioCreacion,
                        //DocumentId = _InsuranceEndorsementq.InsuranceEndorsementId,
                    };

                    //Accounting account = await _context.Accounting.Where(acc => acc.AccountId == _InsuranceEndorsementq.AccountId).FirstOrDefaultAsync();
                    //_je.JournalEntryLines.Add(new JournalEntryLine
                    //{
                    //    AccountId = Convert.ToInt32(_InsuranceEndorsementq.AccountId),
                    //    //Description = _InsuranceEndorsementq.Account.AccountName,
                    //    Description = account.AccountName,
                    //    Credit = 0,
                    //    Debit = _InsuranceEndorsementq.Total,
                    //    CreatedDate = DateTime.Now,
                    //    ModifiedDate = DateTime.Now,
                    //    CreatedUser = _InsuranceEndorsementq.UsuarioCreacion,
                    //    ModifiedUser = _InsuranceEndorsementq.UsuarioModificacion,
                    //    Memo = "",
                    //});
                    //foreach (var item in _InsuranceEndorsementq.InsuranceEndorsementLines)
                    //{
                    //    account = await _context.Accounting.Where(acc => acc.AccountId == _InsuranceEndorsementq.AccountId).FirstOrDefaultAsync();
                    //    item.InsuranceEndorsementId = _InsuranceEndorsementq.Id;
                    //    _context.InsuranceEndorsementLine.Add(item);
                    //    _je.JournalEntryLines.Add(new JournalEntryLine
                    //    {
                    //        AccountId = Convert.ToInt32(item.AccountId),
                    //        Description = account.AccountName,
                    //        Credit = item.Total,
                    //        Debit = 0,
                    //        CreatedDate = DateTime.Now,
                    //        ModifiedDate = DateTime.Now,
                    //        CreatedUser = _InsuranceEndorsementq.UsuarioCreacion,
                    //        ModifiedUser = _InsuranceEndorsementq.UsuarioModificacion,
                    //        Memo = "",
                    //    });
                    //}

                    await _context.SaveChangesAsync();

                    double sumacreditos = 0, sumadebitos = 0;
                    if (sumacreditos != sumadebitos)
                    {
                        transaction.Rollback();
                        _logger.LogError($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}");
                        return(BadRequest($"Ocurrio un error: No coinciden debitos :{sumadebitos} y creditos{sumacreditos}"));
                    }

                    _je.TotalCredit = sumacreditos;
                    _je.TotalDebit  = sumadebitos;
                    _context.JournalEntry.Add(_je);

                    await _context.SaveChangesAsync();

                    BitacoraWrite _write = new BitacoraWrite(_context, new Bitacora
                    {
                        IdOperacion  = 4, ///////Falta definir los Id de las Operaciones
                        DocType      = "InsuranceEndorsement",
                        ClaseInicial =
                            Newtonsoft.Json.JsonConvert.SerializeObject(_InsuranceEndorsementq, new JsonSerializerSettings {
                            ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                        }),
                        ResultadoSerializado = Newtonsoft.Json.JsonConvert.SerializeObject(_InsuranceEndorsementq, new JsonSerializerSettings {
                            ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                        }),
                        Accion              = "Insert",
                        FechaCreacion       = DateTime.Now,
                        FechaModificacion   = DateTime.Now,
                        UsuarioCreacion     = _InsuranceEndorsementq.UsuarioCreacion,
                        UsuarioModificacion = _InsuranceEndorsementq.UsuarioModificacion,
                        UsuarioEjecucion    = _InsuranceEndorsementq.UsuarioModificacion,
                    });
                    await _context.SaveChangesAsync();

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                    throw ex;
                }
            }


            return(await Task.Run(() => Ok(_InsuranceEndorsementq)));
        }