private void Delete() { try { if (Tabladetallemov.Rows.Count == 0) { MessageBox.Show("Documento no tiene Items !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (numdoc.Text.Trim().Length == 10) { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.moduloid = modulo; BE.local = local; BE.tipodoc = tipodoc.SelectedValue.ToString(); BE.serdoc = serdoc.Text.Trim(); BE.numdoc = numdoc.Text.Trim(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); NIVEL_FORMS(); MessageBox.Show("Datos eliminados correctamente !!!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); limpiar_documento(); form_bloqueado(false); btn_nuevo.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_salir.Enabled = true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void form_cargar_datos(String posicion) { try { limpiar_documento(); var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); var dt = new DataTable(); BE.moduloid = modulo; BE.local = local; BE.tipodoc = tipodoc.SelectedValue.ToString().Trim(); if (serdoc.Text.Trim().Length > 0) { BE.serdoc = serdoc.Text.Trim().PadLeft(4, '0'); BE.numdoc = numdoc.Text.Trim().PadLeft(10, '0'); } else { if (posicion.Trim().Length > 0) { MessageBox.Show("Seleccionar el Tipo de Documento !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } if (numdoc.Text.Trim().Length > 0) { BE.numdoc = numdoc.Text.Trim().PadLeft(10, '0'); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { ssModo = "EDIT"; userinventario.Text = dt.Rows[0]["userinventario"].ToString().Trim(); cmblinea2.SelectedValue = dt.Rows[0]["lineaid"].ToString(); serdoc.Text = dt.Rows[0]["serdoc"].ToString().Trim(); numdoc.Text = dt.Rows[0]["numdoc"].ToString().Trim(); fechdoc.Text = dt.Rows[0]["fechdoc"].ToString().Trim(); totpzas.Text = dt.Rows[0]["totpzasl"].ToString().Trim(); totpzas2.Text = dt.Rows[0]["totpzasf"].ToString().Trim(); glosa.Text = dt.Rows[0]["glosa"].ToString().Trim(); itemsT.Text = dt.Rows[0]["items"].ToString().Trim(); data_Tabladetallemovmov(); btn_editar.Enabled = true; btn_eliminar.Enabled = true; btnImprimirNoval.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_salir.Enabled = true; griddetallemov.Focus(); griddetallemov.Rows[0].Selected = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ValidaTabladetallemovmov(String valproductid) { var xproductid = string.Empty; Decimal xstocklibros = 0, xstockfisico = 0, xdiferencia = 0; xproductid = valproductid.Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productname"].Value = string.Empty; if (xproductid.Trim().Length == 13) { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); var DT = new DataTable(); BE.moduloid = modulo; BE.productid = xproductid; DT = BL.GetOneNew(EmpresaID, BE).Tables[0]; if (DT.Rows.Count > 0) { griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productid"].Value = DT.Rows[0]["productid"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productname"].Value = DT.Rows[0]["productname"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stocklibros"].Value = DT.Rows[0]["stocklibros"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stockfisico"].Value = DT.Rows[0]["stockfisico"].ToString().Trim(); xstocklibros = Convert.ToDecimal(DT.Rows[0]["stocklibros"].ToString()); xstockfisico = Convert.ToDecimal(DT.Rows[0]["stockfisico"].ToString()); xdiferencia = xstocklibros - xstockfisico; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["diferencia"].Value = xdiferencia; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["costopromlibros"].Value = DT.Rows[0]["costopromlibros"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["costopromfisico"].Value = DT.Rows[0]["costopromfisico"].ToString().Trim(); Tabladetallemov.AcceptChanges(); griddetallemov.CurrentCell = griddetallemov.Rows[griddetallemov.RowCount - 1].Cells["stockfisico"]; } else { MessageBox.Show("Producto no existe en tabla LOCAL_STOCK !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Producto no existe !!! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_Tabladetallemovmov() { try { Decimal xxdiferencia = 0, xxstockfisico = 0, xxstocklibros = 0; griddetallemov.AutoGenerateColumns = false; var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); var dt = new DataTable(); BE.moduloid = modulo; BE.local = local; BE.tipodoc = tipodoc.SelectedValue.ToString().Trim(); BE.serdoc = serdoc.Text.Trim().PadLeft(4, '0'); BE.numdoc = numdoc.Text.Trim().PadLeft(10, '0'); dt = BL.GetAll_datosdetalle(EmpresaID, BE).Tables[0]; if (Tabladetallemov != null) { Tabladetallemov.Clear(); } foreach (DataRow fila in dt.Rows) { var BL2 = new tb_60local_stock_inventarioBL(); var BE2 = new tb_60local_stock_inventario(); var dt2 = new DataTable(); BE2.moduloid = modulo; BE2.local = local; BE2.productid = fila["productid"].ToString(); dt2 = BL2.GetOneNew(EmpresaID, BE2).Tables[0]; if (dt2.Rows.Count > 0) { } row = Tabladetallemov.NewRow(); row["items"] = fila["items"].ToString(); row["productid"] = fila["productid"].ToString().Trim(); row["productname"] = fila["productname"].ToString().Trim(); row["stocklibros"] = fila["stocklibros"].ToString(); row["stockfisico"] = fila["stockfisico"].ToString(); xxstocklibros = Convert.ToDecimal(fila["stocklibros"].ToString()); xxstockfisico = Convert.ToDecimal(fila["stockfisico"].ToString()); xxdiferencia = xxstocklibros - xxstockfisico; ubic.Text = fila["codigoubic"].ToString(); row["diferencia"] = xxdiferencia; row["costopromlibros"] = Convert.ToDecimal(fila["costopromlibros"].ToString()); row["costopromfisico"] = Convert.ToDecimal(fila["costopromfisico"].ToString()); Tabladetallemov.Rows.Add(row); } griddetallemov.DataSource = Tabladetallemov; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_limpiar_Click(object sender, EventArgs e) { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.moduloid = modulo; BE.local = local; BE.fechdoc = Convert.ToDateTime(fechatoma.Text.ToString()); var sw_prosigue = false; sw_prosigue = (MessageBox.Show("Desea Eliminar Archivo de Trabajo...?", "Mensaje del Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes); if (sw_prosigue) { if (BL.Delete_archivo(EmpresaID, BE)) { MessageBox.Show("Registros Eliminados Correctamente ... !!!", "Información"); limpiar_documento(); } } }
private void Update() { try { if (Tabladetallemov.Rows.Count == 0) { MessageBox.Show("Documento no tiene Items !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); var Detalle = new tb_60local_stock_inventario.Item(); var ListaItems = new List<tb_60local_stock_inventario.Item>(); BE.dominioid = dominio; BE.moduloid = modulo; BE.local = local; BE.lineaid = cmblinea2.SelectedValue.ToString(); BE.tipodoc = tipodoc.SelectedValue.ToString(); BE.serdoc = serdoc.Text; BE.numdoc = numdoc.Text; BE.items = itemsT.Text.Trim(); BE.totpzasl = totpzas.Text.Trim(); BE.totpzasf = totpzas2.Text.Trim(); BE.userinventario = userinventario.Text; BE.glosa = glosa.Text.Trim().ToUpper().ToString(); BE.fechdoc = Convert.ToDateTime(fechdoc.Text); BE.usuar = VariablesPublicas.Usuar; var item = 0; foreach (DataRow fila in Tabladetallemov.Rows) { Detalle = new tb_60local_stock_inventario.Item(); item++; Detalle.items = fila["items"].ToString(); Detalle.productid = fila["productid"].ToString(); Detalle.stocklibros = Convert.ToDecimal(fila["stocklibros"].ToString()); Detalle.stockfisico = Convert.ToDecimal(fila["stockfisico"].ToString()); Detalle.costopromlibros = Convert.ToDecimal(fila["costopromlibros"].ToString()); Detalle.costopromfisico = Convert.ToDecimal(fila["costopromfisico"].ToString()); Detalle.fechdoc = Convert.ToDateTime(fechdoc.Text); Detalle.userinventariado = userinventario.Text; Detalle.codigoubic = ubic.Text; Detalle.usuar = VariablesPublicas.Usuar; if (fila["productid"].ToString().Trim().Length == 13 && Convert.ToDecimal(fila["stockfisico"]) > 0) { ListaItems.Add(Detalle); } else { MessageBox.Show("Documento DETALLE EN FORMATO INCORRECTO !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (ListaItems.Count == 0) { MessageBox.Show("Documento SIN DETALLE Y/O DETALLE INCORRECTO !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BE.ListaItems = ListaItems; if (BL.Update(EmpresaID, BE)) { SEGURIDAD_LOG("M"); NIVEL_FORMS(); MessageBox.Show("Datos modificados correctamente !!!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); form_bloqueado(false); btn_nuevo.Enabled = true; btnImprimirNoval.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_salir.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnNew_Click(object sender, EventArgs e) { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.moduloid = modulo; BE.local = local; var sw_prosigue = false; sw_prosigue = (MessageBox.Show("Desea Tomar Nuevo Inventariado...?", "Mensaje del Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes); if (sw_prosigue) { BL.GetAll_New(EmpresaID, BE); cargar_lineasiLSI(); limpiar_documento(); } }
private void btn_generar_Click(object sender, EventArgs e) { fech_ini.Text = DateTime.Now.ToLongTimeString(); var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); try { BE.moduloid = modulo; BE.local = local; BE.fechdoc = Convert.ToDateTime(fechatoma.Text.Trim().Substring(0, 10)); BE.usuar = VariablesPublicas.Usuar.Trim(); if (BL.GetAll_INICIALIZAR_ROLLO(EmpresaID, BE)) { fech_fin.Text = DateTime.Now.ToLongTimeString(); MessageBox.Show("Proceso terminado Correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Proceso Truncado", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_process_Click(object sender, EventArgs e) { var sw_prosigue = false; var msg2 = "Usuario : " + VariablesPublicas.Nombr + "\nEste Proceso es Irreversible" + "\nUna vez concluído se borrarán datos del archivo de trabajo"; sw_prosigue = (MessageBox.Show(msg2, "Desea Proseguir !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes); if (sw_prosigue) { fech_ini.Text = DateTime.Now.Date.ToShortDateString(); var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.dominioid = dominio; BE.moduloid = modulo; BE.local = local; BE.fechdoc = Convert.ToDateTime(fech_ini.Text.ToString()); try { if (BL.Ajuste_Inv(VariablesPublicas.EmpresaID.ToString(), BE)) // Con esto hace el ajuste de Inventario { fech_fin.Text = DateTime.Now.ToLongTimeString(); if (BL.GetAll_New(EmpresaID, BE)) // Con esto Elimina los datos de tb_av_local_stock_inventario { MessageBox.Show("Proceso Terminado Correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Proceso Inconcluso", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Contactese con Sistema !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private DataTable Lista_DiferenciaInv() { DtReporte = new DataTable("Productostock"); try { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.moduloid = moduloid.Trim(); BE.local = local.Trim(); BE.lineaid = lineaid.Trim(); BE.dif = dif; DtReporte = BL.GetReportDif(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (DtReporte != null) { return DtReporte; } else { return null; } } catch (Exception ex) { return null; } }
private DataTable Lista_inventariofisico() { DtReporte = new DataTable("Productostock"); try { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); BE.moduloid = moduloid.Trim(); BE.local = local.Trim(); BE.tipodoc = tipdoc.Trim(); BE.serdoc = serdoc.Trim(); BE.numdoc = numdoc.Trim(); DtReporte = BL.GetReport(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (DtReporte != null) { return DtReporte; } else { return DtReporte; } } catch (Exception ex) { return null; } }
private void btn_generar_Click(object sender, EventArgs e) { fech_ini.Text = DateTime.Now.ToLongTimeString(); var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); var lineaid = string.Empty; var max = list2List1.listaderecha.Items.Count; try { if (max > 0) { for (var i = 0; i < max; i++) { lineaid = Convert.ToString(list2List1.listaderecha.Items[i]).ToString().Substring(0, 3); BE.moduloid = modulo; BE.local = local; BE.lineaid = lineaid; BE.fechdoc = Convert.ToDateTime(fechatoma.Text.Trim().Substring(0, 10)); BE.usuar = VariablesPublicas.Usuar.Trim(); if (BL.GetAll_INICIALIZAR(EmpresaID, BE)) { fech_fin.Text = DateTime.Now.ToLongTimeString(); MessageBox.Show("Proceso terminado Correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); list2List1.listaderecha.Items.Clear(); list2List1.listaizquierda.Items.Clear(); list2List1.listaizquierda.Refresh(); cargar_linea(); cargar_lineasiLSI(); } else { MessageBox.Show("Proceso Truncado", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } else { MessageBox.Show("Agrega Lineas A Generar ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_excel_Click(object sender, EventArgs e) { var BL = new tb_60local_stock_inventarioBL(); var BE = new tb_60local_stock_inventario(); DataTable dt = new DataTable(); BE.moduloid = modulo.Trim(); BE.local = local.Trim(); BE.lineaid = lineaid.Text.Trim(); BE.dif = chk_diferencias.Checked; dt = BL.GetReportDif(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (dt.Rows.Count > 0) { ExportarExcel(dt); } }