コード例 #1
0
        private void cbMpago_SelectedIndexChanged(object sender, EventArgs e)
        {
            Models.Configuration configuracion = new Models.Configuration();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();
                switch (cbMpago.Text)
                {
                case "Tarjeta de Debito":
                    double nuevo_total = deberia_ser + ((deberia_ser / 100) * config[0].Debito);
                    lbCobrar.Text = string.Format("{0:#,0.00}", nuevo_total);
                    calcula();
                    break;

                case "Tarjeta de Credito":

                    double nuevo_total2 = deberia_ser + ((deberia_ser / 100) * config[0].Credito);
                    lbCobrar.Text = string.Format("{0:#,0.00}", nuevo_total2);
                    calcula();
                    break;

                default:
                    lbCobrar.Text = string.Format("{0:#,0.00}", deberia_ser);
                    calcula();
                    break;
                }
            }
        }
コード例 #2
0
 private void timbrar()
 {
     Models.Configuration configuracion = new Models.Configuration();
     using (configuracion)
     {
         List <Models.Configuration> config = configuracion.getConfiguration();
         //Instancias del timbrado
         Timbrado.StampSOAP selloSOAP = new Timbrado.StampSOAP();
         stamp         oStamp         = new stamp();
         stampResponse selloResponse  = new stampResponse();
         //Cargas tu archivo xml
         XmlDocument xmlDocument = new XmlDocument();
         xmlDocument.Load(config[0].Ruta_factura + txtFolio.Text + ".xml");
         //xmlDocument.Load(config[0].Ruta_factura + txtFolio.Text + ".xml");
         //Conviertes el archivo en byte
         byte[] byteXmlDocument = Encoding.UTF8.GetBytes(xmlDocument.OuterXml);
         //Conviertes el byte resultado en base64
         string stringByteXmlDocument = Convert.ToBase64String(byteXmlDocument);
         //Convirtes el resultado nuevamente a byte
         byteXmlDocument = Convert.FromBase64String(stringByteXmlDocument);
         //Timbras el archivo
         oStamp.xml      = byteXmlDocument;
         oStamp.username = "******";
         oStamp.password = "******";
         //Generamos request
         String usuario;
         usuario = Environment.UserName;
         String        url  = config[0].Ruta_factura;
         StreamWriter  XML  = new StreamWriter(url + "SOAP_Request.xml");             //Direccion donde guardaremos el SOAP Envelope
         XmlSerializer soap = new XmlSerializer(oStamp.GetType());                    //Obtenemos los datos del objeto oStamp que contiene los parámetros de envió y es de tipo stamp()
         soap.Serialize(XML, oStamp);
         XML.Close();
         //Recibes la respuesta de timbrado
         selloResponse = selloSOAP.stamp(oStamp);
         try
         {
             MessageBox.Show("No se timbro el XML" + "\nCódigo de error: " + selloResponse.stampResult.Incidencias[0].CodigoError.ToString() + "\nMensaje: " + selloResponse.stampResult.Incidencias[0].MensajeIncidencia);
         }
         catch (Exception)
         {
             MessageBox.Show(selloResponse.stampResult.CodEstatus.ToString());
             Models.Facturas factura = new Models.Facturas();
             using (factura)
             {
                 factura.Uuid  = selloResponse.stampResult.UUID.ToString();
                 factura.Folio = Convert.ToInt32(txtFolio.Text);
                 factura.Xml   = selloResponse.stampResult.xml.ToString();
                 factura.update_uuid();
             }
             StreamWriter XMLL = new StreamWriter(url + txtFolio.Text + ".xml");
             XMLL.Write(selloResponse.stampResult.xml);
             XMLL.Close();
             File.Delete(url + "SOAP_Request.xml");
         }
     }
 }
コード例 #3
0
ファイル: Ganancias.cs プロジェクト: ivanhdzderas/cremeria
 private void button3_Click(object sender, EventArgs e)
 {
     Models.Configuration config = new Models.Configuration();
     using (config)
     {
         List <Models.Configuration> configuracion = config.getConfiguration();
         DataTable         dtbl = maketable();
         Models.Export_pdf pdf  = new Models.Export_pdf();
         pdf.ExportDatatablePdf(dtbl, configuracion[0].Ruta_reportes + "/Ganancias.pdf", "Ganancias");
         MessageBox.Show("Terminado");
     }
 }
コード例 #4
0
ファイル: Ganancias.cs プロジェクト: ivanhdzderas/cremeria
 private void button2_Click(object sender, EventArgs e)
 {
     Models.Configuration config = new Models.Configuration();
     using (config)
     {
         List <Models.Configuration> configuracion = config.getConfiguration();
         DataTable           dtbl  = maketable();
         Models.Export_excel excel = new Models.Export_excel();
         excel.ExportToExcel(dtbl, configuracion[0].Ruta_reportes + "/Ganancias");
         MessageBox.Show("Terminado");
     }
 }
コード例 #5
0
 private void button4_Click(object sender, EventArgs e)
 {
     Models.Configuration config = new Models.Configuration();
     using (config)
     {
         List <Models.Configuration> configuracion = config.getConfiguration();
         DataTable           dtbl  = inventario_para();
         Models.Export_excel excel = new Models.Export_excel();
         excel.ExportToExcel(dtbl, configuracion[0].Ruta_reportes + "inv");
         MessageBox.Show("Terminado");
         OpenMicrosoftExcel(configuracion[0].Ruta_reportes + "inv.xlsx");
     }
 }
コード例 #6
0
        private void imprimir()
        {
            printDocument1 = new PrintDocument();
            Models.Configuration configuracion = new Models.Configuration();
            int cuantos   = dtProductos.RowCount;
            int faltantes = 0;
            int valor;

            using (configuracion)
            {
                faltantes = cuantos - 1;
                valor     = 110 * faltantes;
                valor     = valor + 1150;
                PaperSize ps = new PaperSize("Custom", 300, valor);
                List <Models.Configuration> config = configuracion.getConfiguration();
                printDocument1.DefaultPageSettings.PaperSize = ps;
                printDocument1.PrinterSettings.PrinterName   = config[0].Impresora;
                printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
                printDocument1.Print();
            }
        }
コード例 #7
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Models.Configuration configuracion = new Models.Configuration();
            Models.Dev_prov      devoluciones  = new Models.Dev_prov();
            Models.Providers     proveedores   = new Models.Providers();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();
                Font font   = new Font("Verdana", 8, FontStyle.Regular);
                int  y      = 70;
                var  format = new StringFormat()
                {
                    Alignment = StringAlignment.Center
                };
                double cambio = 0;
                if (config[0].Logo_ticket != "")
                {
                    if (File.Exists(config[0].Logo_ticket))
                    {
                        Image logo = Image.FromFile(config[0].Logo_ticket);
                        e.Graphics.DrawImage(logo, new Rectangle(0, 00, 250, 70));
                    }
                }

                string fecha = "";
                using (devoluciones)
                {
                    List <Models.Dev_prov> listas = devoluciones.get_devolucionesbyfolio(Folio_guardado);
                    fecha = listas[0].Fecha;
                    List <Models.Providers> providers = proveedores.getProviderbyId(listas[0].Id_proveedor);
                    if (providers.Count > 0)
                    {
                        y = y + 10;
                        e.Graphics.DrawString(providers[0].Name, font, Brushes.Black, 125, y, format);
                        y = y + 10;
                        e.Graphics.DrawString(providers[0].RFC, font, Brushes.Black, 125, y, format);
                        y = y + 10;
                        string calle = providers[0].Street + " " + providers[0].Ext_number;
                        if (providers[0].Int_number != "")
                        {
                            calle += "-" + providers[0].Int_number;
                        }
                        e.Graphics.DrawString(calle, font, Brushes.Black, 125, y, format);
                        y = y + 10;
                        e.Graphics.DrawString(providers[0].Muni + " " + providers[0].State, font, Brushes.Black, 125, y, format);
                        y = y + 10;
                        e.Graphics.DrawString("Telefono" + providers[0].Tel, font, Brushes.Black, 125, y, format);
                    }
                }

                format = new StringFormat()
                {
                    Alignment = StringAlignment.Far
                };
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);


                y = y + 15;
                e.Graphics.DrawString("Devolucion: " + Folio_guardado.ToString(), font, Brushes.Black, 0, y);
                y = y + 15;
                e.Graphics.DrawString("Fecha: " + fecha.ToString(), font, Brushes.Black, 0, y);
                y = y + 20;
                e.Graphics.DrawString("Cant.", font, Brushes.Black, 50, y, format);
                e.Graphics.DrawString("P/U.", font, Brushes.Black, 120, y, format);

                e.Graphics.DrawString("IMPTE.", font, Brushes.Black, 220, y, format);
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);

                double totali = 0;
                Models.det_dev_prov detallado = new Models.det_dev_prov();
                Models.Product      productos = new Models.Product();
                using (detallado)
                {
                    List <Models.det_dev_prov> list = detallado.get_detalles(Folio_guardado);
                    if (list.Count > 0)
                    {
                        foreach (Models.det_dev_prov item in list)
                        {
                            using (productos)
                            {
                                List <Models.Product> producto = productos.getProductById(item.Id_producto);


                                y = y + 30;
                                e.Graphics.DrawString(producto[0].Description, font, Brushes.Black, 10, y);
                                e.Graphics.DrawString(item.Cantidad.ToString(), font, Brushes.Black, 50, y + 10, format);
                                e.Graphics.DrawString(string.Format("{0:#,0.00}", item.Pu), font, Brushes.Black, 120, y + 10, format);

                                e.Graphics.DrawString(string.Format("{0:#,0.00}", (item.Pu * item.Cantidad)), font, Brushes.Black, 220, y + 10, format);
                                totali = totali + 1;
                            }
                        }
                    }
                }
                y = y + 15;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                y = y + 15;
                e.Graphics.DrawString("Total", font, Brushes.Black, 120, y, format);

                e.Graphics.DrawString("$ " + string.Format("{0:#,0.00}", txtTotal.Text), font, Brushes.Black, 220, y, format);
            }
            Folio_guardado = 0;
        }
コード例 #8
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Models.Configuration  configuracion = new Models.Configuration();
            Models.Devolutions    devoluciones  = new Models.Devolutions();
            Models.det_devolution detallado     = new Models.det_devolution();
            Models.Product        productos     = new Models.Product();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();
                Font font   = new Font("Verdana", 8, FontStyle.Regular);
                int  y      = 70;
                var  format = new StringFormat()
                {
                    Alignment = StringAlignment.Center
                };
                if (config[0].Logo_ticket != "")
                {
                    if (File.Exists(config[0].Logo_ticket))
                    {
                        Image logo = Image.FromFile(config[0].Logo_ticket);
                        e.Graphics.DrawImage(logo, new Rectangle(0, 00, 250, 70));
                    }
                }
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].RFC, font, Brushes.Black, 125, y, format);
                y = y + 10;
                string calle = config[0].Calle + " " + config[0].No_ext;
                if (config[0].No_int != "")
                {
                    calle += "-" + config[0].No_int;
                }
                e.Graphics.DrawString(calle, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Municipio + " " + config[0].Estado, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString("Telefono" + config[0].Telefono, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                format = new StringFormat()
                {
                    Alignment = StringAlignment.Far
                };
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                y = y + 15;
                using (devoluciones)
                {
                    List <Models.Devolutions> devo = devoluciones.get_devolucionesbyid(Folio_guardado);
                    e.Graphics.DrawString("Folio: " + devo[0].Id, font, Brushes.Black, 0, y);
                    y = y + 20;
                    e.Graphics.DrawString("Cant.", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString("P/U.", font, Brushes.Black, 120, y, format);

                    e.Graphics.DrawString("IMPTE.", font, Brushes.Black, 220, y, format);
                    y = y + 10;
                    e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                    using (detallado)
                    {
                        List <Models.det_devolution> det = detallado.get_detalle(Folio_guardado);
                        using (productos)
                        {
                            foreach (Models.det_devolution item in det)
                            {
                                List <Models.Product> producto = productos.getProductById(item.Id_producto);
                                y = y + 30;
                                e.Graphics.DrawString(producto[0].Description, font, Brushes.Black, 10, y);
                                e.Graphics.DrawString(item.Cantidad.ToString(), font, Brushes.Black, 50, y + 10, format);
                                e.Graphics.DrawString(string.Format("{0:#,0.00}", item.Pu), font, Brushes.Black, 120, y + 10, format);


                                e.Graphics.DrawString(string.Format("{0:#,0.00}", (item.Cantidad * item.Pu)), font, Brushes.Black, 220, y + 10, format);
                            }
                        }
                    }
                    y = y + 15;
                    e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                    y = y + 15;
                    e.Graphics.DrawString("Total", font, Brushes.Black, 150, y + 10, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", devo[0].Total), font, Brushes.Black, 220, y + 10, format);
                }
            }
        }
コード例 #9
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Models.Configuration configuracion = new Models.Configuration();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();
                Font font   = new Font("Verdana", 8, FontStyle.Regular);
                int  y      = 70;
                var  format = new StringFormat()
                {
                    Alignment = StringAlignment.Center
                };
                if (config[0].Logo_ticket != "")
                {
                    if (File.Exists(config[0].Logo_ticket))
                    {
                        Image logo = Image.FromFile(config[0].Logo_ticket);
                        e.Graphics.DrawImage(logo, new Rectangle(0, 00, 250, 70));
                    }
                }
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].RFC, font, Brushes.Black, 125, y, format);
                y = y + 10;
                string calle = config[0].Calle + " " + config[0].No_ext;
                if (config[0].No_int != "")
                {
                    calle += "-" + config[0].No_int;
                }
                e.Graphics.DrawString(calle, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Municipio + " " + config[0].Estado, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString("Telefono" + config[0].Telefono, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                format = new StringFormat()
                {
                    Alignment = StringAlignment.Far
                };
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                double total_retirado = 0;
                y = y + 15;
                e.Graphics.DrawString("Retiro de dinero ", font, Brushes.Black, 0, y);

                if (txtMonto.Text == "")
                {
                    y = y + 15;

                    e.Graphics.DrawString("Cantidad", font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString("Total", font, Brushes.Black, 220, y, format);
                    y = y + 10;
                    e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                    y = y + 30;


                    e.Graphics.DrawString("$ 1000", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num1000.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num1000.Value * 1000)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num1000.Value * 1000);
                    y = y + 15;
                    e.Graphics.DrawString("$ 500", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num500.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num500.Value * 500)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num500.Value * 500);
                    y = y + 15;
                    e.Graphics.DrawString("$ 200", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num200.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num200.Value * 200)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num200.Value * 200);
                    y = y + 15;
                    e.Graphics.DrawString("$ 100", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num100.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num100.Value * 100)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num100.Value * 100);
                    y = y + 15;
                    e.Graphics.DrawString("$ 50", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num50.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num50.Value * 50)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num50.Value * 50);
                    y = y + 15;
                    e.Graphics.DrawString("$ 20", font, Brushes.Black, 50, y, format);
                    e.Graphics.DrawString(num20.Value.ToString(), font, Brushes.Black, 150, y, format);
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", (num20.Value * 20)), font, Brushes.Black, 220, y, format);
                    total_retirado = total_retirado + Convert.ToDouble(num20.Value * 20);
                    y = y + 15;
                    e.Graphics.DrawString("Total retirado $ " + string.Format("{0:#,0.00}", total_retirado), font, Brushes.Black, 150, y, format);
                }
                else
                {
                    y = y + 15;
                    e.Graphics.DrawString("Pago a proveedor", font, Brushes.Black, 50, y);
                    y = y + 15;
                    e.Graphics.DrawString(txtProveedor.Text, font, Brushes.Black, 50, y);
                    y = y + 15;
                    e.Graphics.DrawString("Monto", font, Brushes.Black, 50, y);
                    y = y + 15;
                    e.Graphics.DrawString(string.Format("{0:#,0.00}", Convert.ToDouble(txtMonto.Text)), font, Brushes.Black, 50, y);
                }
                y = y + 30;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                y = y + 10;
                e.Graphics.DrawString("Recibido", font, Brushes.Black, 150, y);
            }
        }
コード例 #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            double monto;

            if (txtMonto.Text == "")
            {
                monto = 0;
            }
            else
            {
                monto = Convert.ToDouble(txtMonto.Text);
            }
            int id_proveedor;

            if (txtIdproveedor.Text == "")
            {
                id_proveedor = 0;
            }
            else
            {
                id_proveedor = Convert.ToInt16(txtIdproveedor.Text);
            }
            Models.retiro_efectivo retiros = new Models.retiro_efectivo();
            using (retiros)
            {
                retiros.Monto           = suma;
                retiros.Usuario         = usuario;
                retiros.Monto_proveedor = monto;
                retiros.Id_proveedor    = id_proveedor;
                retiros.Notas           = txtNotas.Text;
                retiros.createRetiro();
                List <Models.retiro_efectivo> reti = retiros.get_lastretiro(usuario);

                Models.det_retiro detalle = new Models.det_retiro();
                using (detalle)
                {
                    detalle.Id_retiro = reti[0].Id;

                    detalle.Billete  = 1000;
                    detalle.Cantidad = Convert.ToInt16(num1000.Value);
                    detalle.crate_det_retiro();

                    detalle.Billete  = 500;
                    detalle.Cantidad = Convert.ToInt16(num500.Value);
                    detalle.crate_det_retiro();

                    detalle.Billete  = 200;
                    detalle.Cantidad = Convert.ToInt16(num200.Value);
                    detalle.crate_det_retiro();

                    detalle.Billete  = 100;
                    detalle.Cantidad = Convert.ToInt16(num100.Value);
                    detalle.crate_det_retiro();

                    detalle.Billete  = 50;
                    detalle.Cantidad = Convert.ToInt16(num50.Value);
                    detalle.crate_det_retiro();

                    detalle.Billete  = 20;
                    detalle.Cantidad = Convert.ToInt16(num20.Value);
                    detalle.crate_det_retiro();
                }
            }

            MessageBox.Show("Retiro efectuado con exito", "Retiro", MessageBoxButtons.OK, MessageBoxIcon.Information);
            printDocument1 = new PrintDocument();
            PrinterSettings ps = new PrinterSettings();

            Models.Configuration configuracion = new Models.Configuration();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();

                printDocument1.PrinterSettings             = ps;
                printDocument1.PrinterSettings.PrinterName = config[0].Impresora;
                printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
                printDocument1.PrinterSettings.Copies = 2;
                printDocument1.Print();
            }
            this.Close();
        }
コード例 #11
0
        private void Configuracion_Load(object sender, EventArgs e)
        {
            txtDebito.TextAlign  = HorizontalAlignment.Right;
            txtCredito.TextAlign = HorizontalAlignment.Right;

            DataTable table = new DataTable();
            DataRow   row;

            table.Columns.Add("Text", typeof(string));
            table.Columns.Add("Value", typeof(string));
            row          = table.NewRow();
            row["Text"]  = "";
            row["Value"] = "";
            table.Rows.Add(row);
            // cboMarca.Items.Clear();
            String pkInstalledPrinters;

            for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                pkInstalledPrinters = PrinterSettings.InstalledPrinters[i];
                row          = table.NewRow();
                row["Text"]  = pkInstalledPrinters;
                row["Value"] = pkInstalledPrinters;
                table.Rows.Add(row);
            }
            cbImpresora.BindingContext = new BindingContext();
            cbImpresora.DataSource     = table;
            cbImpresora.DisplayMember  = "Text";
            cbImpresora.ValueMember    = "Value";
            cbImpresora.BindingContext = new BindingContext();


            cbImpreReportes.BindingContext = new BindingContext();
            cbImpreReportes.DataSource     = table;
            cbImpreReportes.DisplayMember  = "Text";
            cbImpreReportes.ValueMember    = "Value";
            cbImpreReportes.BindingContext = new BindingContext();


            DataTable table2 = new DataTable();
            DataRow   row2;

            table2.Columns.Add("Text", typeof(string));
            table2.Columns.Add("Value", typeof(string));
            row2          = table2.NewRow();
            row2["Text"]  = "";
            row2["Value"] = "";
            table2.Rows.Add(row2);

            row2          = table2.NewRow();
            row2["Text"]  = "YAHOO";
            row2["Value"] = "YAHOO";
            table2.Rows.Add(row2);

            row2          = table2.NewRow();
            row2["Text"]  = "HOTMAIL";
            row2["Value"] = "HOTMAIL";
            table2.Rows.Add(row2);

            row2          = table2.NewRow();
            row2["Text"]  = "GMAIL";
            row2["Value"] = "GMAIL";
            table2.Rows.Add(row2);

            row2          = table2.NewRow();
            row2["Text"]  = "OTRO";
            row2["Value"] = "OTRO";
            table2.Rows.Add(row2);

            cbProveedor.BindingContext = new BindingContext();
            cbProveedor.DataSource     = table2;
            cbProveedor.DisplayMember  = "Text";
            cbProveedor.ValueMember    = "Value";
            cbProveedor.BindingContext = new BindingContext();


            Models.Configuration config = new Models.Configuration();
            using (config)
            {
                List <Models.Configuration> item = config.getConfiguration();
                Id                = item[0].Id;
                txtRazon.Text     = item[0].Razon_social;
                txtComercial.Text = item[0].Nombre_comercial;
                txtRFC.Text       = item[0].RFC;
                txtCalle.Text     = item[0].Calle;
                txtExterior.Text  = item[0].No_ext;
                txtInterior.Text  = item[0].No_int;
                txtColonia.Text   = item[0].Colonia;
                txtPoblacion.Text = item[0].Municipio;
                txtEstado.Text    = item[0].Estado;
                txtPais.Text      = item[0].Pais;
                txtTelefono.Text  = item[0].Telefono;
                txtRegimen.Text   = item[0].Regimen;
                txtSerie.Text     = item[0].Serie;
                txtFolio.Text     = item[0].Folio.ToString();
                txtRuta.Text      = item[0].Ruta_factura;
                txtLogo.Text      = item[0].Logo;
                txtPieTicket.Text = item[0].Pie_ticket;
                if (File.Exists(txtLogo.Text))
                {
                    pbLogo.Image = Image.FromFile(txtLogo.Text);
                }
                txtLogoTicket.Text = item[0].Logo_ticket;
                if (File.Exists(txtLogoTicket.Text))
                {
                    pbLogoTicket.Image = Image.FromFile(txtLogoTicket.Text);
                }
                txtKey.Text                   = item[0].Key;
                txtCer.Text                   = item[0].Cer;
                txtContra.Text                = item[0].Pass;
                txtEmail.Text                 = item[0].Email;
                chkSsl.Checked                = Convert.ToBoolean(item[0].Ssl);
                txtPassEmail.Text             = item[0].Contra_smtp;
                cbProveedor.SelectedValue     = item[0].Proveedor;
                txtSmtp.Text                  = item[0].Smtp_serv;
                txtSmtpPort.Text              = item[0].Smtp_Port.ToString();
                txtCuerpo.Text                = item[0].Cuerpo_email;
                chkticket.Checked             = Convert.ToBoolean(item[0].Tipo_Impre);
                cbImpresora.SelectedValue     = item[0].Impresora;
                cbImpreReportes.SelectedValue = item[0].Impresora_reportes;
                txtRutas.Text                 = item[0].Ruta_reportes;

                txtCredito.Text = item[0].Credito.ToString();
                txtDebito.Text  = item[0].Debito.ToString();
                chkIva.Checked  = item[0].Iva_incluido;
            }
        }
コード例 #12
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Models.Configuration configuracion = new Models.Configuration();
            using (configuracion)
            {
                List <Models.Configuration> config = configuracion.getConfiguration();
                Font font   = new Font("Verdana", 8, FontStyle.Regular);
                int  y      = 70;
                var  format = new StringFormat()
                {
                    Alignment = StringAlignment.Center
                };


                if (config[0].Logo_ticket != "")
                {
                    if (File.Exists(config[0].Logo_ticket))
                    {
                        Image logo = Image.FromFile(config[0].Logo_ticket);
                        e.Graphics.DrawImage(logo, new Rectangle(0, 00, 250, 70));
                    }
                }
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].RFC, font, Brushes.Black, 125, y, format);
                y = y + 10;
                string calle = config[0].Calle + " " + config[0].No_ext;
                if (config[0].No_int != "")
                {
                    calle += "-" + config[0].No_int;
                }
                e.Graphics.DrawString(calle, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Municipio + " " + config[0].Estado, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString("Telefono" + config[0].Telefono, font, Brushes.Black, 125, y, format);
                y = y + 10;
                e.Graphics.DrawString(config[0].Razon_social, font, Brushes.Black, 125, y, format);
                format = new StringFormat()
                {
                    Alignment = StringAlignment.Far
                };
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);

                y = y + 15;
                e.Graphics.DrawString("Transferencia: " + txtFolios.Text, font, Brushes.Black, 0, y);

                /* y = y + 10;
                 * e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                 */
                y = y + 20;
                e.Graphics.DrawString("Cant.", font, Brushes.Black, 50, y, format);
                e.Graphics.DrawString("P/U.", font, Brushes.Black, 100, y, format);

                e.Graphics.DrawString("IMPTE.", font, Brushes.Black, 220, y, format);
                y = y + 10;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                foreach (DataGridViewRow row in dtProductos.Rows)
                {
                    y = y + 30;
                    e.Graphics.DrawString(row.Cells["descripcion"].Value.ToString(), font, Brushes.Black, 10, y);
                    e.Graphics.DrawString(row.Cells["cantidad"].Value.ToString(), font, Brushes.Black, 50, y + 10, format);
                    e.Graphics.DrawString(formato(row.Cells["p_u"].Value.ToString()), font, Brushes.Black, 100, y + 10, format);

                    e.Graphics.DrawString(formato(row.Cells["Importe"].Value.ToString()), font, Brushes.Black, 220, y + 10, format);
                }
                y = y + 15;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
                y = y + 15;

                e.Graphics.DrawString("Total", font, Brushes.Black, 150, y + 10, format);
                e.Graphics.DrawString(txtSubtotal.Text, font, Brushes.Black, 220, y + 10, format);

                y = y + 40;
                intercambios inter = new intercambios();
                e.Graphics.DrawString(inter.enletras(txtSubtotal.Text), font, Brushes.Black, 0, y);

                y = y + 30;
                e.Graphics.DrawString("___________________________________________", font, Brushes.Black, 0, y);
            }
        }
コード例 #13
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (cbOficinas.Text == "")
            {
                MessageBox.Show("Seleccione una sucursal", "Sucursal", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbOficinas.Focus();
            }
            else
            {
                if (recuperado == false)
                {
                    Models.Transfers transferencia = new Models.Transfers();
                    using (transferencia)
                    {
                        transferencia.Folio        = Convert.ToInt16(txtFolios.Text);
                        transferencia.Tipo_trapaso = "E";
                        transferencia.Sucursal     = cbOficinas.SelectedValue.ToString();
                        transferencia.Subtotal     = Convert.ToDouble(txtSubtotal.Text);
                        transferencia.Iva          = 0;
                        transferencia.Total        = 0;
                        transferencia.Facturado    = Convert.ToInt16(false);
                        transferencia.CreateTransfer();
                        List <Models.Transfers> ultimo = transferencia.getTransferbyfolio(Convert.ToInt16(txtFolios.Text), "E");

                        Models.Det_transfers detalles = new Models.Det_transfers();
                        using (detalles)
                        {
                            detalles.Folio = Convert.ToInt16(txtFolios.Text);
                            detalles.Tipo  = "E";

                            Models.Product poductos = new Models.Product();
                            foreach (DataGridViewRow row in dtProductos.Rows)
                            {
                                detalles.Cantidad    = Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                                detalles.Id_producto = Convert.ToInt16(row.Cells["id"].Value.ToString());
                                detalles.Precio      = Convert.ToDouble(row.Cells["p_u"].Value.ToString());
                                detalles.CreateDet();
                                using (poductos)
                                {
                                    List <Models.Product> producto = poductos.getProductById(Convert.ToInt16(row.Cells["id"].Value.ToString()));
                                    Models.Kardex         kardex   = new Models.Kardex();
                                    using (kardex)
                                    {
                                        kardex.Id_producto  = Convert.ToInt16(row.Cells["id"].Value.ToString());
                                        kardex.Tipo         = "T";
                                        kardex.Id_documento = ultimo[0].Id;
                                        kardex.Cantidad     = Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                                        kardex.Antes        = producto[0].Existencia;
                                        kardex.CreateKardex();

                                        List <Models.Kardex> ultimo_kardez = kardex.getidKardex(Convert.ToInt16(row.Cells["id"].Value.ToString()), ultimo[0].Id, "T");
                                        Models.Afecta_inv    afecta        = new Models.Afecta_inv();
                                        using (afecta)
                                        {
                                            afecta.Disminuye(ultimo_kardez[0].Id);
                                        }
                                    }
                                }
                            }
                        }
                    }


                    Models.Folios folio = new Models.Folios();
                    using (folio)
                    {
                        folio.Transferencia = (Convert.ToInt16(txtFolios.Text) + 1);
                        folio.savenewTransfer();
                    }
                }
                else
                {
                    Models.Transfers transferencia = new Models.Transfers();
                    using (transferencia)
                    {
                        transferencia.Folio        = Convert.ToInt32(txtFolios.Text);
                        transferencia.Tipo_trapaso = "E";
                        transferencia.Sucursal     = cbOficinas.SelectedValue.ToString();
                        transferencia.Subtotal     = Convert.ToDouble(txtSubtotal.Text);
                        transferencia.Iva          = 0;
                        transferencia.Total        = 0;
                        transferencia.Facturado    = Convert.ToInt16(false);
                        transferencia.updateTrasfer();
                    }
                    Models.Det_transfers detalles = new Models.Det_transfers();
                    using (detalles)
                    {
                        detalles.Folio = Convert.ToInt32(txtFolios.Text);
                        detalles.delete_det();

                        detalles.Folio = Convert.ToInt16(txtFolios.Text);
                        detalles.Tipo  = "E";

                        Models.Product poductos = new Models.Product();
                        foreach (DataGridViewRow row in dtProductos.Rows)
                        {
                            detalles.Cantidad    = Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                            detalles.Id_producto = Convert.ToInt16(row.Cells["id"].Value.ToString());
                            detalles.Precio      = Convert.ToDouble(row.Cells["p_u"].Value.ToString());
                            detalles.CreateDet();
                            using (poductos)
                            {
                                List <Models.Product> producto = poductos.getProductById(Convert.ToInt16(row.Cells["id"].Value.ToString()));
                                Models.Kardex         kardex   = new Models.Kardex();
                                using (kardex)
                                {
                                    kardex.Id_producto  = Convert.ToInt16(row.Cells["id"].Value.ToString());
                                    kardex.Tipo         = "T";
                                    kardex.Id_documento = id_transfer;
                                    kardex.Cantidad     = Convert.ToDouble(row.Cells["cantidad"].Value.ToString());
                                    kardex.Antes        = producto[0].Existencia;
                                    kardex.CreateKardex();

                                    List <Models.Kardex> ultimo_kardez = kardex.getidKardex(Convert.ToInt16(row.Cells["id"].Value.ToString()), id_transfer, "T");
                                    Models.Afecta_inv    afecta        = new Models.Afecta_inv();
                                    using (afecta)
                                    {
                                        afecta.Disminuye(ultimo_kardez[0].Id);
                                    }
                                }
                            }
                        }
                    }
                }


                Models.Configuration configuracion = new Models.Configuration();
                int cuantos   = dtProductos.RowCount;
                int faltantes = 0;
                int valor;


                using (configuracion)
                {
                    faltantes = cuantos - 1;

                    valor = 110 * faltantes;

                    valor = valor + 1150;
                    PaperSize ps = new PaperSize("Custom", 300, valor);
                    List <Models.Configuration> config = configuracion.getConfiguration();

                    printDocument1.DefaultPageSettings.PaperSize = ps;
                    printDocument1.PrinterSettings.PrinterName   = config[0].Impresora;
                    printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);

                    printDocument1.Print();
                }


                this.Close();
            }
        }
コード例 #14
0
 private void xml2()
 {
     Models.Configuration configuracion = new Models.Configuration();
     Models.Client        clientes      = new Models.Client();
     Models.Product       productos     = new Models.Product();
     using (configuracion)
     {
         using (clientes)
         {
             using (productos)
             {
                 List <Models.Configuration> config = configuracion.getConfiguration();
                 DateTime            dt             = DateTime.Now;
                 DateTime            x            = Convert.ToDateTime(String.Format("{0:s}", dt));
                 Comprobante         oComprobante = new Comprobante();
                 ComprobanteEmisor   oEmisor      = new ComprobanteEmisor();
                 ComprobanteReceptor oReceptor    = new ComprobanteReceptor();
                 string username = "******";
                 string password = "******";
                 string CertFile = config[0].Cer;
                 string KeyFile = config[0].Key;
                 string KeyPass = config[0].Pass;
                 string Errores = "";
                 string noCertificado, aa, b, c;
                 SelloDigital.leerCER(CertFile, out aa, out b, out c, out noCertificado);
                 oComprobante.Folio             = txtFolio.Text;
                 oComprobante.Version           = "3.3";
                 oComprobante.Fecha             = x.ToString("yyyy-MM-ddTHH:mm:ss");
                 oComprobante.Serie             = "A";
                 oComprobante.NoCertificado     = noCertificado;
                 oComprobante.SubTotal          = Convert.ToDecimal(DoFormat(Convert.ToDouble(txtSubtotal.Text)));
                 oComprobante.Moneda            = "MXN";
                 oComprobante.Total             = Convert.ToDecimal(DoFormat(Convert.ToDouble(txtSubtotal.Text)));
                 oComprobante.TipoDeComprobante = "I";
                 oComprobante.FormaPago         = txtFpago.Text;
                 oComprobante.CondicionesDePago = "CONTADO";
                 oComprobante.MetodoPago        = txtMPago.Text;
                 oComprobante.LugarExpedicion   = config[0].Cp;
                 oEmisor.Rfc           = config[0].RFC;
                 oEmisor.Nombre        = config[0].Razon_social;
                 oEmisor.RegimenFiscal = config[0].Regimen;
                 List <Models.Client> cliente                             = clientes.getClientbyId(Convert.ToInt16(txtIdCliente.Text));
                 oReceptor.Rfc         = cliente[0].RFC;
                 oReceptor.UsoCFDI     = txtUsoCfdi.Text;
                 oReceptor.Nombre      = txtCliente.Text;
                 oComprobante.Emisor   = oEmisor;
                 oComprobante.Receptor = oReceptor;
                 List <Models.Product>      producto                      = null;
                 List <ComprobanteConcepto> lstConceptos                  = new List <ComprobanteConcepto>();
                 foreach (DataGridViewRow row in dtProductos.Rows)
                 {
                     ComprobanteConcepto oConcepto = new ComprobanteConcepto();
                     producto = productos.getProductById(Convert.ToInt16(row.Cells["id_producto"].Value.ToString()));
                     List <ComprobanteConceptoImpuestosTraslado> Ltraslados  = new List <ComprobanteConceptoImpuestosTraslado>();
                     ComprobanteConceptoImpuestos         oConoceptoimpuesto = new ComprobanteConceptoImpuestos();
                     ComprobanteConceptoImpuestosTraslado oConcepto_traslado = new ComprobanteConceptoImpuestosTraslado();
                     oConcepto.ClaveProdServ = producto[0].Code_sat;
                     oConcepto.Cantidad      = Convert.ToDecimal(row.Cells["cantidad"].Value.ToString());
                     oConcepto.ClaveUnidad   = producto[0].Medida_sat;
                     oConcepto.Descripcion   = row.Cells["descripcion"].Value.ToString();
                     oConcepto.ValorUnitario = Convert.ToDecimal(DoFormat(Convert.ToDouble(row.Cells["pu"].Value.ToString())));
                     oConcepto.Importe       = Convert.ToDecimal(DoFormat(Convert.ToDouble(row.Cells["total"].Value.ToString())));
                     //oConcepto.Descuento = Convert.ToDecimal(0);
                     oConcepto.Unidad                       = "PIEZA";
                     oConcepto.NoIdentificacion             = producto[0].Code1;
                     oConcepto_traslado.Base                = Convert.ToDecimal(DoFormat(Convert.ToDouble(row.Cells["total"].Value.ToString())));
                     oConcepto_traslado.Impuesto            = "002";
                     oConcepto_traslado.TipoFactor          = "Tasa";
                     oConcepto_traslado.TasaOCuota          = Convert.ToDecimal("0.000000");
                     oConcepto_traslado.Importe             = Convert.ToDecimal(DoFormat(Convert.ToDouble(row.Cells["total"].Value.ToString()))) * 0;
                     oConcepto_traslado.TasaOCuotaSpecified = true;
                     oConcepto_traslado.ImporteSpecified    = true;
                     Ltraslados.Add(oConcepto_traslado);
                     oConoceptoimpuesto.Traslados = Ltraslados.ToArray();
                     oConcepto.Impuestos          = oConoceptoimpuesto;
                     lstConceptos.Add(oConcepto);
                 }
                 oComprobante.Conceptos = lstConceptos.ToArray();
                 ComprobanteImpuestos                oImpuuestos          = new ComprobanteImpuestos();
                 List <ComprobanteImpuestos>         lImpuestos           = new List <ComprobanteImpuestos>();
                 ComprobanteImpuestosTraslado        oImpuestos_traslados = new ComprobanteImpuestosTraslado();
                 List <ComprobanteImpuestosTraslado> lImpuestos_traslados = new List <ComprobanteImpuestosTraslado>();
                 oImpuestos_traslados.Impuesto   = "002";
                 oImpuestos_traslados.TipoFactor = "Tasa";
                 oImpuestos_traslados.TasaOCuota = Convert.ToDecimal("0.000000");
                 oImpuestos_traslados.Importe    = Convert.ToDecimal("0.00");
                 lImpuestos_traslados.Add(oImpuestos_traslados);
                 oImpuuestos.TotalImpuestosRetenidos            = Convert.ToDecimal(0.00);
                 oImpuuestos.TotalImpuestosTrasladadosSpecified = true;
                 oImpuuestos.Traslados  = lImpuestos_traslados.ToArray();
                 oComprobante.Impuestos = oImpuuestos;
                 xml(oComprobante, config[0].Ruta_factura + txtFolio.Text + ".xml");
                 string CadenaOriginal                                    = "";
                 string path_cad                                          = @"XSLT\cadenaoriginal_3_3.xslt";
                 System.Xml.Xsl.XslCompiledTransform transformador        = new System.Xml.Xsl.XslCompiledTransform(true);
                 transformador.Load(path_cad);
                 using (StringWriter sw = new StringWriter())
                 {
                     using (XmlWriter xwo = XmlWriter.Create(sw, transformador.OutputSettings))
                     {
                         transformador.Transform(config[0].Ruta_factura + txtFolio.Text + ".xml", xwo);
                         CadenaOriginal = sw.ToString();
                     }
                 }
                 SelloDigital sellodigital = new SelloDigital();
                 oComprobante.Certificado = sellodigital.Certificado(CertFile);
                 oComprobante.Sello       = sellodigital.Sellar(CadenaOriginal, KeyFile, KeyPass);
                 xml(oComprobante, config[0].Ruta_factura + txtFolio.Text + ".xml");
                 timbrar();
             }
         }
     }
 }
コード例 #15
0
        private void xml2()
        {
            Models.Configuration configuracion = new Models.Configuration();
            Models.Client        clientes      = new Models.Client();
            Models.Product       productos     = new Models.Product();
            using (configuracion)
            {
                using (clientes)
                {
                    using (productos)
                    {
                        List <Models.Configuration> config = configuracion.getConfiguration();
                        CFDI3_VB.CFDx CFDs = new CFDI3_VB.CFDx();

                        DateTime dt = DateTime.Now;
                        DateTime x  = Convert.ToDateTime(String.Format("{0:s}", dt));

                        var _with1 = CFDs;

                        _with1.Comprobante(Folio: txtFolio.Text, Fecha: x, SubTotal: txtSubtotal.Text, Moneda: "MXN", Total: txtTotal.Text, TipoDeComprobante: "I", LugarDeExpedicion: config[0].Cp.ToString(), Serie: "A", FormaPago: txtFpago.Text,
                                           CondicionesDePago: null, Descuento: "0.00", TipoCambio: "1", MetodoPago: txtMPago.Text, Confirmacion: null);



                        _with1.AgregarEmisor(Rfc: config[0].RFC, RegimenFiscal: config[0].Regimen, Nombre: config[0].Nombre_comercial);
                        List <Models.Client> cliente = clientes.getClientbyId(Convert.ToInt16(txtIdCliente.Text));
                        _with1.AgregarReceptor(Rfc: cliente[0].RFC, UsoCFDI: txtUsoCfdi.Text, Nombre: txtCliente.Text, ResidenciaFiscal: null, NumRegIdTrib: null);

                        List <Models.Product> producto = null;
                        foreach (DataGridViewRow row in dtProductos.Rows)
                        {
                            producto = productos.getProductById(Convert.ToInt16(row.Cells["id_producto"].Value.ToString()));
                            //detalle_facturas.Id_producto = Convert.ToInt16(row.Cells["id_producto"].Value.ToString());
                            _with1.AgregarConcepto(ClaveProdServ: producto[0].Code_sat, Cantidad: row.Cells["cantidad"].Value.ToString(), ClaveUnidad: producto[0].Medida_sat, Descripcion: row.Cells["descripcion"].Value.ToString(), ValorUnitario: row.Cells["pu"].Value.ToString(), Importe: row.Cells["total"].Value.ToString(), Descuento: "0.00", Unidad: producto[0].Unit, NoIdentificacion: producto[0].Code1, InformacionAduanera: null,
                                                   CuentaPredial: null, TrasladoImpuesto: CFDI3_VB.ComprobanteConceptoImpuestosTrasladoImpuesto.Item002, TrasladoBase: row.Cells["total"].Value.ToString(), TrasladoTipoFactor: "Tasa", TrasladoTasaOCuota: "0.00000", TrasladoImporte: "0.00", RetenidoImpuesto: CFDI3_VB.ComprobanteConceptoImpuestosRetencionImpuesto.Item002, RetenidoBase: "0.00", RetenidoTipoFactor: "Tasa", RetenidoTasaOCuota: "0.000000",
                                                   RetenidoImporte: "0.00");
                        }

                        //CONCEPTO 1................................



                        _with1.AgregarImpuesto(TrasladoImpuesto: CFDI3_VB.ComprobanteImpuestosTrasladoImpuesto.Item002, TrasladoTasa: "0.000000", TrasladoTipoFactor: "Tasa", TrasladoImporte: "0.00", RetenidoImpuesto: CFDI3_VB.ComprobanteImpuestosRetencionImpuesto.Item002, RetenidoImporte: "0.00");


                        string username = "******";
                        string password = "******";
                        //string Path = (@"C:\Certificados");
                        string CertFile = (config[0].Cer);
                        string KeyFile  = (config[0].Key);
                        string KeyPass  = config[0].Pass;
                        //Dim Errores As String = ""
                        string Errores = "";

                        if (CFDs.CrearFacturaXML(username, password, KeyFile, KeyPass, CertFile, ref Errores, Ruta: config[0].Ruta_factura, nameXML: txtFolio.Text))
                        {
                            timbrar();
                        }
                        else
                        {
                            MessageBox.Show("Error al generar CFDI");
                        }
                    }
                }
            }
        }