private void Productos_Load(object sender, EventArgs e) { carga(); 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(); Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> result = oficinas.GetOffices(); foreach (Models.Offices item in result) { row = table.NewRow(); row["Text"] = item.Name; row["Value"] = item.Id; table.Rows.Add(row); } } cbOficina.BindingContext = new BindingContext(); cbOficina.DataSource = table; cbOficina.DisplayMember = "Text"; cbOficina.ValueMember = "Value"; cbOficina.BindingContext = new BindingContext(); }
private void carga() { dtTraspasos.Rows.Clear(); Models.Offices oficinas = new Models.Offices(); Models.Transfers transferencias = new Models.Transfers(); using (transferencias) { List <Models.Transfers> tranfer = transferencias.getTransfers_e(); foreach (Models.Transfers item in tranfer) { using (oficinas) { if (item.Sucursal == "") { dtTraspasos.Rows.Add(item.Id, item.Folio, "", item.Fecha, item.Subtotal); } else { List <Models.Offices> sucursal = oficinas.GetOfficesbyid(Convert.ToInt16(item.Sucursal)); dtTraspasos.Rows.Add(item.Id, item.Folio, sucursal[0].Name, item.Fecha, item.Subtotal); } } } } }
private void button1_Click(object sender, EventArgs e) { Models.Offices oficinas = new Models.Offices(); using (oficinas) { oficinas.Name = txtNombre.Text; oficinas.Domicilio = txtDomicilio.Text; oficinas.Telefono = txtTelefono.Text; oficinas.Servidor = txtServidor.Text; oficinas.Connection = txtCone.Text; oficinas.Notas = txtNotas.Text; oficinas.Factura = txtFacturacion.Text; oficinas.Rfc = txtRfc.Text; oficinas.Interior = txtInterior.Text; oficinas.Exterior = txtExterior.Text; oficinas.Calle = txtCalle.Text; oficinas.Colonia = txtColonia.Text; oficinas.Cp = txtCp.Text; oficinas.Municipio = txtMunicipio.Text; oficinas.Estado = txtEstado.Text; if (id != 0) { oficinas.Id = id; oficinas.SaveOffice(); } else { oficinas.CreateOffice(); } } this.Close(); }
public void carga() { dtOficinas.Rows.Clear(); Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> lista = oficinas.GetOffices(); foreach (Models.Offices item in lista) { dtOficinas.Rows.Add(item.Id, item.Name, item.Telefono, item.Domicilio); } } }
private AutoCompleteStringCollection cargadatos2() { AutoCompleteStringCollection datos = new AutoCompleteStringCollection(); Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> oficina = oficinas.GetOffices(); foreach (Models.Offices item in oficina) { datos.Add(item.Name); } } return(datos); }
private void Form_sucursal_Load(object sender, EventArgs e) { if (id != 0) { Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> oficina = oficinas.GetOfficesbyid(id); txtNombre.Text = oficina[0].Name; txtDomicilio.Text = oficina[0].Domicilio; txtTelefono.Text = oficina[0].Telefono; txtServidor.Text = oficina[0].Servidor; txtCone.Text = oficina[0].Connection; txtNotas.Text = oficina[0].Notas; txtFacturacion.Text = oficina[0].Factura; txtRfc.Text = oficina[0].Rfc; txtInterior.Text = oficina[0].Interior; txtExterior.Text = oficina[0].Exterior; txtCalle.Text = oficina[0].Calle; txtColonia.Text = oficina[0].Colonia; txtCp.Text = oficina[0].Cp; txtMunicipio.Text = oficina[0].Municipio; txtEstado.Text = oficina[0].Estado; } } else { txtNombre.Text = ""; txtDomicilio.Text = ""; txtTelefono.Text = ""; txtServidor.Text = ""; txtCone.Text = ""; txtNotas.Text = ""; txtFacturacion.Text = ""; txtRfc.Text = ""; txtInterior.Text = ""; txtExterior.Text = ""; txtCalle.Text = ""; txtColonia.Text = ""; txtCp.Text = ""; txtMunicipio.Text = ""; txtEstado.Text = ""; } }
private void button5_Click(object sender, EventArgs e) { Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> lista = oficinas.GetOfficesbyid(Convert.ToInt32(cbOficina.SelectedValue.ToString())); if (lista[0].Connection != "") { //Inicial.connectionString = lista[0].Connection; connectionstring2 = lista[0].Connection; carga2(); } else { MessageBox.Show("No se puede conectar con la sucursal"); } } }
private void txtIdSucursal_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> oficina = oficinas.GetOfficesbyid(Convert.ToInt16(txtIdSucursal.Text)); txtSucursal.Text = oficina[0].Name; Models.Transfers traspasos = new Models.Transfers(); List <Models.Transfers> traspaso = traspasos.getTransferbysucursal(Convert.ToInt16(txtIdSucursal.Text)); foreach (Models.Transfers item in traspaso) { dtTrasferencias.Rows.Add(item.Id, item.Folio, item.Fecha, item.Total); } } } }
private void form_transfer_Load(object sender, EventArgs e) { lbFecha.Visible = false; this.txtFolios.AutoSize = true; txtCodigo.AutoCompleteCustomSource = cargadatos(); txtCodigo.AutoCompleteMode = AutoCompleteMode.Suggest; txtCodigo.AutoCompleteSource = AutoCompleteSource.CustomSource; 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); Models.Offices oficinas = new Models.Offices(); using (oficinas) { List <Models.Offices> oficina = oficinas.GetOffices(); foreach (Models.Offices ofi in oficina) { row = table.NewRow(); row["Text"] = ofi.Name; row["Value"] = ofi.Id; table.Rows.Add(row); } } cbOficinas.BindingContext = new BindingContext(); cbOficinas.DataSource = table; cbOficinas.DisplayMember = "Text"; cbOficinas.ValueMember = "Value"; cbOficinas.BindingContext = new BindingContext(); if (id_transfer == 0) { get_folio(); } else { recuperado = true; Models.Transfers traspasos = new Models.Transfers(); using (traspasos) { List <Models.Transfers> traspaso = traspasos.getTransferbyid(id_transfer); if (traspaso.Count > 0) { lbFecha.Text = traspaso[0].Fecha.ToString(); cbOficinas.SelectedValue = traspaso[0].Sucursal; txtFolios.Text = traspaso[0].Folio.ToString(); } } Models.Det_transfers det = new Models.Det_transfers(); Models.Product productos = new Models.Product(); using (det) { using (productos) { List <Models.Det_transfers> detallado = det.getDet_trans(Convert.ToInt32(txtFolios.Text)); if (detallado.Count > 0) { foreach (Models.Det_transfers item in detallado) { List <Models.Product> producto = productos.getProductById(item.Id_producto); dtProductos.Rows.Insert(0, item.Id_producto, item.Cantidad, producto[0].Code1, producto[0].Description, item.Precio, (item.Precio * item.Cantidad)); } } } } } }
private void generar() { System.Data.DataTable tabla1 = new System.Data.DataTable(); tabla1.Columns.Add("Usuario"); tabla1.Columns.Add("Fecha"); tabla1.Columns.Add("Descripcion"); Models.Log historia = new Models.Log(); Models.Users usuarios = new Models.Users(); using (historia) { using (usuarios) { List <Models.Log> logs = historia.get_logbydate(DateTime.Now.ToString("yyyy-MM-dd")); if (logs.Count > 0) { foreach (Models.Log item in logs) { List <Models.Users> usuario = usuarios.getUserbyid(item.Id_usuario); tabla1.Rows.Add(usuario[0].Nombre, item.Fecha, item.Descripcion); } } } } System.Data.DataTable tabla2 = new System.Data.DataTable(); tabla2.Columns.Add("Folio"); tabla2.Columns.Add("Sucursal"); tabla2.Columns.Add("Total"); Models.Reports.Transferencias transferencias = new Models.Reports.Transferencias(); Models.Offices sucursales = new Models.Offices(); using (transferencias) { using (sucursales) { List <Models.Reports.Transferencias> transfer = transferencias.getTransferbyDate(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), "E"); if (transfer.Count > 0) { foreach (Models.Reports.Transferencias item in transfer) { List <Models.Offices> oficina = sucursales.GetOfficesbyid(Convert.ToInt32(item.Sucursal)); tabla2.Rows.Add(item.Folio, oficina[0].Name, item.Monto); } } } } System.Data.DataTable tabla3 = new System.Data.DataTable(); tabla3.Columns.Add("Monto"); System.Data.DataTable tabla4 = new System.Data.DataTable(); tabla4.Columns.Add("Proveedor"); tabla4.Columns.Add("Monto"); double Total_proveedor = 0; Models.retiro_efectivo retiros = new Models.retiro_efectivo(); Models.Providers proveedores = new Models.Providers(); using (retiros) { List <Models.retiro_efectivo> retiro = retiros.get_retiro_fecha(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd")); if (retiro.Count > 0) { foreach (Models.retiro_efectivo item in retiro) { if (item.Id_proveedor == 0) { if (item.Monto != 0) { tabla3.Rows.Add(item.Monto); } else { tabla3.Rows.Add(item.Monto_proveedor); } } else { using (proveedores) { Total_proveedor = Total_proveedor + item.Monto_proveedor; List <Models.Providers> proveedor = proveedores.getProviderbyId(item.Id_proveedor); tabla4.Rows.Add(proveedor[0].Name, item.Monto_proveedor); } } } } } double total_tickets = 0; System.Data.DataTable tabla5 = new System.Data.DataTable(); tabla5.Columns.Add("Tickets"); tabla5.Columns.Add("Traspasos"); tabla5.Columns.Add("Total del dia"); Models.Reports.Tickets tickets = new Models.Reports.Tickets(); using (tickets) { List <Models.Reports.Tickets> listado = tickets.get_tickets(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd")); if (listado.Count > 0) { foreach (Models.Reports.Tickets item in listado) { total_tickets = total_tickets + item.Total; } } } tabla5.Rows.Add(total_tickets, Total_proveedor, (total_tickets + Total_proveedor)); Models.Export_pdf pdf = new Models.Export_pdf(); pdf.genera_reporte(tabla1, tabla2, tabla3, tabla4, tabla5, "reporte.pdf", "Reporte diario"); intercambios intercambios = new intercambios(); intercambios.enviar_correo("reporte.pdf", "Envio reporte del dia", "Reporte Diario"); }