示例#1
0
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCommand command = new SqlCommand("PJ_ReciboReparto", conection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@TipoConsulta", 8);
                command.Parameters.AddWithValue("@JefaCobranza", string.Empty);
                command.Parameters.AddWithValue("@Cliente", FolioActualizar);
                command.Parameters.AddWithValue("@Vendedor", 0);
                command.Parameters.AddWithValue("@Revision", string.Empty);
                command.Parameters.AddWithValue("@Cobro", string.Empty);

                DataTable      table   = new DataTable();
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = command;
                adapter.Fill(table);

                DSReparto _dsImprimir = new DSReparto();

                string _jefa = "";
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow item in table.Rows)
                    {
                        DataRow row = _dsImprimir.Tables["Listado"].NewRow();
                        row["Clave"]                = item.Field <string>("Clave");
                        row["Cliente"]              = item.Field <string>("Cliente");
                        row["Actividad"]            = item.Field <string>("Actividad");
                        row["Fecha de factura"]     = item.Field <DateTime>("FechaFactura");
                        row["Factura"]              = item.Field <string>("Factura");
                        row["Facturado"]            = item.Field <decimal>("Facturado");
                        row["Saldo"]                = item.Field <decimal>("Saldo");
                        row["Fecha de vencimiento"] = item.Field <DateTime>("FechaVencimiento");
                        row["FechaCreacion"]        = item.Field <DateTime>("Docdate");
                        _jefa = item.Field <string>("JefaCobranza");
                        _dsImprimir.Tables["Listado"].Rows.Add(row);
                    }

                    DataRow rowc = _dsImprimir.Tables["Jefa Cobranza"].NewRow();
                    rowc["Nombre jefa"] = _jefa;
                    _dsImprimir.Tables["Jefa Cobranza"].Rows.Add(rowc);

                    DataRow rowv = _dsImprimir.Tables["Vendedor"].NewRow();
                    rowv["Nombre vendedor"] = FolioActualizar;
                    _dsImprimir.Tables["Vendedor"].Rows.Add(rowv);

                    ReporteCrystal f = new ReporteCrystal(_dsImprimir, @"\\192.168.2.100\HalcoNET\Crystal\ReporteRecibo.rpt", "Listado de cobranza");
                    f.MdiParent   = this.MdiParent;
                    f.WindowState = FormWindowState.Maximized;
                    f.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
示例#2
0
        private void button6_Click(object sender, EventArgs e)
        {
            string Folio = GetFolio().ToString("000000");

            DSReparto _ds = new DSReparto();

            _ds.Tables["Listado"].Clear();
            _ds.Tables["Jefa Cobranza"].Clear();
            _ds.Tables["Vendedor"].Clear();

            DataTable dt = (DataTable)gridRecibo.DataSource;

            foreach (DataGridViewRow item in gridRecibo.Rows)
            {
                if (Convert.ToBoolean(item.Cells[(int)Columnas.Enviar].Value))
                {
                    DataRow row = _ds.Tables["Listado"].NewRow();
                    row["Clave"]                = Convert.ToString(item.Cells[(int)Columnas.Clave].Value);
                    row["Cliente"]              = Convert.ToString(item.Cells[(int)Columnas.Cliente].Value);
                    row["Actividad"]            = Convert.ToString(item.Cells[(int)Columnas.Actividad].Value);
                    row["Fecha de factura"]     = Convert.ToDateTime(item.Cells[(int)Columnas.FechaFactura].Value);
                    row["Factura"]              = Convert.ToString(item.Cells[(int)Columnas.Factura].Value);
                    row["Facturado"]            = Convert.ToDecimal(item.Cells[(int)Columnas.Facturado].Value);
                    row["Saldo"]                = Convert.ToDecimal(item.Cells[(int)Columnas.Saldo].Value);
                    row["Fecha de vencimiento"] = Convert.ToDateTime(item.Cells[(int)Columnas.FechaVto].Value);
                    row["FechaCreacion"]        = DateTime.Now;
                    _ds.Tables["Listado"].Rows.Add(row);
                }
            }

            DataRow rowc = _ds.Tables["Jefa Cobranza"].NewRow();

            rowc["Nombre jefa"] = Jefa;
            _ds.Tables["Jefa Cobranza"].Rows.Add(rowc);

            DataRow rowv = _ds.Tables["Vendedor"].NewRow();

            rowv["Nombre vendedor"] = Folio;
            _ds.Tables["Vendedor"].Rows.Add(rowv);

            if (_ds.Tables["Listado"].Rows.Count > 0)
            {
                if (GuardarRecibo(Folio, _ds.Tables["Listado"]))
                {
                    ReporteCrystal f = new ReporteCrystal(_ds, "\\\\192.168.2.100\\HalcoNET\\Crystal\\ReporteRecibo.rpt", "Listado de cobranza");
                    f.MdiParent = this.MdiParent;
                    f.Show();
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar al menos una factura", "HalcoNET", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }