public bool Delete(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Movimientoscab_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc; cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc; cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Insert(string empresaid, tb_60movimientoscab BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll_paginacion(string empresaid, tb_60movimientoscab BE) { return tablaDA.GetAll_paginacion(empresaid, BE); }
public DataSet GetAll_CabDet(string empresaid, tb_60movimientoscab BE) { return tablaDA.GetAll_CabDet(empresaid, BE); }
private void form_cargar_datos(String posicion) { try { limpiar_documento(); var BL = new tb_cm_liquidacabBL(); var BE = new tb_cm_liquidacab(); var dt = new DataTable(); BE.moduloid = moduloiddes.SelectedValue.ToString(); BE.local = local.Trim(); BE.tipdoc = tipdoc.Text.Trim(); BE.serdoc = moduloiddes.SelectedValue.ToString(); if (serdoc.Text.Trim().Length == 0) { if (posicion.Trim().Length > 0) { MessageBox.Show("Seleccionar el Tipo de Documento !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } var n_doc = string.Empty; if (numdoc.Text.Trim().Length > 0) { n_doc = numdoc.Text.Trim().PadLeft(6, '0'); } BE.numdoc = serdoc.Text.ToString().Trim() + n_doc.ToString().Trim(); BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { activeDoc = false; limpiar_documento(); form_bloqueado(false); ssModo = "EDIT"; var BL2 = new tb_60movimientoscabBL(); var BE2 = new tb_60movimientoscab(); var dt2 = new DataTable(); var n = dt.Rows[0]["numdoc"].ToString().Trim(); serdoc.Text = Equivalencias.Left(n, 4); numdoc.Text = Equivalencias.Right(n, 6); tipguia.Text = dt.Rows[0]["tipref"].ToString().Trim(); serguia.Text = dt.Rows[0]["serref"].ToString().Trim(); numguia.Text = dt.Rows[0]["numref"].ToString().Trim(); cif.Text = dt.Rows[0]["cif"].ToString().Trim(); dua.Text = dt.Rows[0]["dua"].ToString().Trim(); gas_impo.Text = dt.Rows[0]["gas_impo"].ToString().Trim(); gas_financ.Text = dt.Rows[0]["gas_financ"].ToString().Trim(); tot_bimp.Text = dt.Rows[0]["tot_bimp"].ToString().Trim(); factorincre.Text = dt.Rows[0]["factorincre"].ToString().Trim(); moduloiddes.SelectedValue = dt.Rows[0]["moduloid"].ToString().Trim(); data_cbo_localdes(dominioiddes, moduloiddes.SelectedValue.ToString()); localdes.SelectedValue = dt.Rows[0]["local"].ToString().Trim(); BE2.moduloid = moduloiddes.SelectedValue.ToString(); BE2.local = localdes.SelectedValue.ToString(); BE2.tipodoc = tipguia.Text.ToString(); BE2.serdoc = serguia.Text.ToString(); BE2.numdoc = numguia.Text; dt2 = BL2.GetAll2(EmpresaID, BE2).Tables[0]; if (dt2.Rows.Count > 0) { tipfac.Text = dt2.Rows[0]["tipfac"].ToString(); serfac.Text = dt2.Rows[0]["serfac"].ToString(); numfac.Text = dt2.Rows[0]["numfac"].ToString(); tipref.Text = dt2.Rows[0]["tipref"].ToString(); numdococ1.Text = Equivalencias.Left(dt2.Rows[0]["numref"].ToString(), 4); numdococ.Text = Equivalencias.Right(dt2.Rows[0]["numref"].ToString(), 6); ctacte.Text = dt2.Rows[0]["ctacte"].ToString(); ctactename.Text = dt2.Rows[0]["ctactename"].ToString(); } _CargarDetalleImportacion(); if (dt.Rows[0]["status"].ToString().Trim() != "9") { btn_nuevo.Enabled = true; btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_salir.Enabled = true; pictureEdit1.Visible = false; } else { ssModo = "ANULADO"; if (TablaDetalleImportacion2.Rows.Count > 0) { TablaDetalleImportacion2.Clear(); } dgb_importacion2.DataSource = TablaDetalleImportacion2; pictureEdit1.Visible = true; btn_editar.Enabled = false; btn_eliminar.Enabled = false; btn_nuevo.Enabled = true; btn_imprimir.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 ValidaTabladetallemovmov(String valproductid) { var xproductid = string.Empty; Decimal xprecio = 0, xprecunit = 0, xcantidad = 0, xcostoprom = 0, tipcamb = 0; var desct1 = 0; Decimal imporfac = 0; Decimal import = 0; Decimal totimpx = 0; xproductid = valproductid.Trim(); var BL_ = new tb_60movimientosBL(); var BE_ = new tb_60movimientoscab(); DataTable dt = new DataTable(); BE_.tip_op = "OP"; BE_.ser_op = ser_op.Text.Trim().PadLeft(4, '0'); BE_.num_op = num_op.Text.Trim().PadLeft(10, '0'); BE_.productoid = xproductid; BE_.moduloid = modulo.Trim().ToString(); BE_.idx = "ONE"; dt = BL_.GetvalidaMov(EmpresaID, BE_).Tables[0]; string arows = dt.Rows[0].Field<string>("Idx"); //if (arows == "0") //{ // MessageBox.Show("El Producto seleccionado no pertenece a la OP N°: " + ser_op.Text + "-" + num_op.Text + // ", \n Verificar OP ", "Confirmación", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //} //else //{ #region griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productname"].Value = string.Empty; txt_stock.Text = "0"; txt_valor.Text = "0"; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["precunit"].Value = "0"; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["importfac"].Value = "0"; if (xproductid.Trim().Length == 13) { var BL = new tb_60local_stockBL(); var BE = new tb_60local_stock(); var DT = new DataTable(); BE.moduloid = modulo.ToString(); BE.local = local.ToString(); BE.productid = xproductid; DT = BL.GetAll(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["unmed"].Value = DT.Rows[0]["unmed"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["rollo"].Value = string.Empty; Decimal lsStock = 0, dtCantidad = 0, mvCantidad = 0, dtstock = 0; lsStock = Convert.ToDecimal(DT.Rows[0]["stock"].ToString().Trim().PadLeft(1, '0')); dtCantidad = Convert.ToDecimal(griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["cantidad"].Value); mvCantidad = Convert.ToDecimal(griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["cantidad_old"].Value); if (almacaccionid.Substring(0, 1) == "1") { dtstock = lsStock + dtCantidad - mvCantidad; } else { if (almacaccionid.Substring(0, 1) == "2") { dtstock = lsStock - dtCantidad + mvCantidad; } } griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stock_old"].Value = lsStock; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stock"].Value = dtstock; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["dalmacaccionid"].Value = almacaccionid.ToString().Trim(); txt_stock.Text = Convert.ToString(dtstock); if (almacaccionid.Substring(0, 1) == "2") { xprecventa = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["precventa"]).ToString("###,###,##0.000000")); // LO COMENTAMOS PORQUE AHORA EL PRECIO LO TRAEMOS DEL COSTO PROMEDIO = costopromed //xprecio = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); xprecio = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costopromed"]).ToString("###,###,##0.000000")); txt_valor.Text = Convert.ToDecimal(DT.Rows[0]["costopromed"].ToString().Trim().PadLeft(1, '0')).ToString("###,###,##0.0000"); xcostoprom = Convert.ToDecimal(DT.Rows[0]["costopromed"].ToString().Trim().PadLeft(1, '0')); } else { if (almacaccionid.Substring(0, 1) == "1") { // LO COMENTAMOS PORQUE AHORA EL PRECIO LO TRAEMOS DEL COSTO PROMEDIO = costopromed //xcostoultimo = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); //xprecio = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); //txt_valor.Text = Convert.ToDecimal(DT.Rows[0]["costoultimo"].ToString().Trim().PadLeft(1, '0')).ToString("###,###,##0.0000"); xcostoultimo = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costopromed"]).ToString("###,###,##0.000000")); xprecio = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costopromed"]).ToString("###,###,##0.000000")); txt_valor.Text = Convert.ToDecimal(DT.Rows[0]["costopromed"].ToString().Trim().PadLeft(1, '0')).ToString("###,###,##0.0000"); } } griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["precventa"].Value = xprecventa; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["costoultimo"].Value = xcostoultimo; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["costopromed"].Value = xcostoprom; xcantidad = Convert.ToDecimal(griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["cantidad"].Value); imporfac = Math.Round(xcantidad * Convert.ToDecimal(xprecio), 6); tipcamb = Convert.ToDecimal(tcamb.Text.Trim()); if (tipcamb <= 0) { tipcamb = 1; } if (moneda.SelectedValue.ToString() == "S") { xprecunit = xprecio; } else { xprecunit = xprecio / tipcamb; } _cal_Igv(); desct1 = 0; import = imporfac * (1 - (desct1 / 100)); if (incprec.Trim() == "S") { totimpx = Math.Round(import * (Convert.ToDecimal(igv) / (100 + Convert.ToDecimal(igv))), 6); } else { totimpx = Math.Round(import * (Convert.ToDecimal(igv) / 100), 6); } griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["valor"].Value = xprecunit; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["importe"].Value = Math.Round(xcantidad * xprecunit, 6); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["dtotimpto"].Value = totimpx; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["cantidad"].Value = xcantidad; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["precunit"].Value = xprecunit; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["importfac"].Value = Math.Round(imporfac, 2); Tabladetallemov.AcceptChanges(); griddetallemov.CurrentCell = griddetallemov.Rows[griddetallemov.RowCount - 1].Cells["cantidad"]; } 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); } #endregion //} }
private void form_cargar_datos(String posicion) { try { limpiar_documento(); var BL = new tb_60movimientoscabBL(); var BE = new tb_60movimientoscab(); 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"; data_cbo_tiporeferencia(almacaccionid); serdoc.Text = dt.Rows[0]["serdoc"].ToString().Trim(); numdoc.Text = dt.Rows[0]["numdoc"].ToString().Trim(); fechdoc.Text = dt.Rows[0]["fechdoc"].ToString().Trim(); tipimptoid = dt.Rows[0]["tipimptoid"].ToString().Trim(); direcnume = dt.Rows[0]["direcnume"].ToString().Trim(); incprec = dt.Rows[0]["incprec"].ToString().Trim(); moneda.SelectedValue = dt.Rows[0]["moneda"].ToString().Trim(); tcamb.Text = dt.Rows[0]["tcamb"].ToString().Trim(); if (dt.Rows[0]["moneda"].ToString().Trim() == "S") { txtmoneda.Text = "S/."; } else { txtmoneda.Text = "US$"; } if (dt.Rows[0]["tipimptoid"].ToString().Trim().Length > 0) { tipimptotasa.SelectedValue = dt.Rows[0]["tipimptoid"].ToString().Trim(); } else { tipimptotasa.SelectedIndex = -1; } ctacte.Text = dt.Rows[0]["ctacte"].ToString().Trim(); nmruc.Text = dt.Rows[0]["nmruc"].ToString().Trim(); ctactename.Text = dt.Rows[0]["ctactename"].ToString().Trim(); direc.Text = dt.Rows[0]["direc"].ToString().Trim(); if (dt.Rows[0]["mottrasladointid"].ToString().Trim().Length > 0 && dt.Rows[0]["mottrasladointid"].ToString().Trim() != "00") { mottrasladointid.SelectedValue = dt.Rows[0]["mottrasladointid"].ToString().Trim(); } else { mottrasladointid.SelectedIndex = -1; } direcname.Text = dt.Rows[0]["direcname"].ToString().Trim(); direcdeta.Text = dt.Rows[0]["direcdeta"].ToString().Trim(); if (dt.Rows[0]["tipoperacionid"].ToString().Trim().Length > 0) { tipoperacionid.SelectedValue = dt.Rows[0]["tipoperacionid"].ToString().Trim(); } else { tipoperacionid.SelectedIndex = -1; } if (dt.Rows[0]["motivotrasladoid"].ToString().Trim().Length > 0 & dt.Rows[0]["motivotrasladoid"].ToString().Trim() != "00") { motivotrasladoid.SelectedValue = dt.Rows[0]["motivotrasladoid"].ToString().Trim(); } else { motivotrasladoid.SelectedIndex = -1; } if (dt.Rows[0]["tipref"].ToString().Trim().Length > 0 && dt.Rows[0]["serref"].ToString().Trim().Length > 0) { tipref.SelectedValue = dt.Rows[0]["tipref"].ToString().Trim(); serref.Text = dt.Rows[0]["serref"].ToString().Trim(); var n = dt.Rows[0]["numref"].ToString().Trim(); numdococ1.Text = Equivalencias.Left(n, 4); numdococ.Text = Equivalencias.Right(n, 6); fechref.Format = DateTimePickerFormat.Short; fechref.Text = dt.Rows[0]["fechref"].ToString().Trim(); } else { tipref.SelectedIndex = -1; } if (dt.Rows[0]["serfac"].ToString().Trim().Length > 0 && dt.Rows[0]["numfac"].ToString().Trim().Length > 0) { tipfac.SelectedValue = dt.Rows[0]["tipfac"].ToString().Trim(); serfac.Text = dt.Rows[0]["serfac"].ToString().Trim(); numfac.Text = dt.Rows[0]["numfac"].ToString().Trim(); fechfac.Format = DateTimePickerFormat.Short; fechfac.Text = dt.Rows[0]["fechfac"].ToString().Trim(); } else { tipfac.SelectedIndex = 0; } if (dt.Rows[0]["serguia"].ToString().Trim().Length > 0 && dt.Rows[0]["numguia"].ToString().Trim().Length > 0) { serguia.Text = dt.Rows[0]["serguia"].ToString().Trim(); numguia.Text = dt.Rows[0]["numguia"].ToString().Trim(); fechguia.Format = DateTimePickerFormat.Short; fechguia.Text = dt.Rows[0]["fechguia"].ToString().Trim(); } if (dt.Rows[0]["sernotac"].ToString().Trim().Length > 0 && dt.Rows[0]["numnotac"].ToString().Trim().Length > 0) { sernotac.Text = dt.Rows[0]["sernotac"].ToString().Trim(); numnotac.Text = dt.Rows[0]["numnotac"].ToString().Trim(); fechnotac.Format = DateTimePickerFormat.Short; fechnotac.Text = dt.Rows[0]["fechnotac"].ToString().Trim(); } if (dt.Rows[0]["ser_op"].ToString().Trim().Length > 0 && dt.Rows[0]["num_op"].ToString().Trim().Length > 0) { ser_op.Text = dt.Rows[0]["ser_op"].ToString().Trim(); num_op.Text = dt.Rows[0]["num_op"].ToString().Trim(); } ValidaCentroCosto(dt.Rows[0]["cencosid"].ToString(), true); ValidaPersona(dt.Rows[0]["perdni"].ToString(), true); if (dt.Rows[0]["fechentrega"].ToString().Trim().Substring(0, 10) != "01/01/1900") { fechentrega.Format = DateTimePickerFormat.Short; fechentrega.Text = dt.Rows[0]["fechentrega"].ToString().Trim(); } if (dt.Rows[0]["fechpago"].ToString().Trim().Substring(0, 10) != "01/01/1900") { fechpago.Format = DateTimePickerFormat.Short; fechpago.Text = dt.Rows[0]["fechpago"].ToString().Trim(); } ValidaTransportista(dt.Rows[0]["transpid"].ToString(), false); ddnni.Text = dt.Rows[0]["ddnni"].ToString().Trim(); itemsT.Text = dt.Rows[0]["items"].ToString().Trim(); totpzas.Text = dt.Rows[0]["totpzas"].ToString().Trim(); bruto.Text = dt.Rows[0]["bruto"].ToString().Trim(); totdscto1.Text = dt.Rows[0]["totdscto1"].ToString().Trim(); valventa.Text = dt.Rows[0]["valventa"].ToString().Trim(); totimpto.Text = dt.Rows[0]["totimpto"].ToString().Trim(); totimporte.Text = dt.Rows[0]["totimporte"].ToString().Trim(); glosa.Text = dt.Rows[0]["glosa"].ToString().Trim(); data_Tabladetallemovmov(); if (dt.Rows[0]["status"].ToString().Trim() != "9") { btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_noval.Enabled = true; btn_imprimir_resum.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_buscar.Enabled = true; btn_salir.Enabled = true; griddetallemov.Focus(); griddetallemov.Rows[0].Selected = false; pdtimagen.Visible = false; } else { ssModo = "ANULADO"; txt_status.Text = "ANULADO"; pdtimagen.Visible = true; btn_editar.Enabled = false; btn_eliminar.Enabled = false; btn_imprimir.Enabled = true; btn_noval.Enabled = true; btn_imprimir_resum.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_buscar.Enabled = true; btn_salir.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet GetvalidaMov(string empresaid, tb_60movimientoscab BE) { return tablaDA.GetvalidaMov(empresaid, BE); }
public DataSet GetOne2(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaMovimientoscab_SELECT2", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc; cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc; cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
private void CargarDocde_Traslado() { var BL = new tb_60movimientoscabBL(); var BE = new tb_60movimientoscab(); BE.moduloid = modulo.ToString(); BE.local = local.ToString(); BE.tipodoc = "GS"; Tabladetalleguias = BL.GetAll3(EmpresaID, BE).Tables[0]; if (Tabladetalleguias.Rows.Count > 0) { dgb_aceptacionguias.DataSource = Tabladetalleguias; } else { dgb_aceptacionguias.DataSource = Tabladetalleguias; } }
public DataSet GetAll(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaMovimientoscab_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc; cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc; cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@almacaccionid", SqlDbType.Char, 2).Value = BE.almacaccionid; cmd.Parameters.Add("@ctacteaccionid", SqlDbType.Char, 2).Value = BE.ctacteaccionid; //cmd.Parameters.Add("@fechdoc", SqlDbType.DateTime).Value = BE.fechdoc; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename; cmd.Parameters.Add("@direcnume", SqlDbType.Char, 6).Value = BE.direcnume; cmd.Parameters.Add("@direcname", SqlDbType.VarChar, 25).Value = BE.direcname; cmd.Parameters.Add("@direcdeta", SqlDbType.VarChar, 70).Value = BE.direcdeta; cmd.Parameters.Add("@direc", SqlDbType.VarChar, 70).Value = BE.direc; cmd.Parameters.Add("@tipdid", SqlDbType.Char, 1).Value = BE.tipdid; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc; cmd.Parameters.Add("@tipref", SqlDbType.Char, 2).Value = BE.tipref; cmd.Parameters.Add("@serref", SqlDbType.Char, 4).Value = BE.serref; cmd.Parameters.Add("@numref", SqlDbType.Char, 10).Value = BE.numref; //cmd.Parameters.Add("@fechref", SqlDbType.DateTime).Value = BE.fechref; cmd.Parameters.Add("@tip_op", SqlDbType.Char, 2).Value = BE.tip_op; cmd.Parameters.Add("@ser_op", SqlDbType.Char, 4).Value = BE.ser_op; cmd.Parameters.Add("@num_op", SqlDbType.Char, 10).Value = BE.num_op; cmd.Parameters.Add("@tipfac", SqlDbType.Char, 2).Value = BE.tipfac; cmd.Parameters.Add("@serfac", SqlDbType.Char, 4).Value = BE.serfac; cmd.Parameters.Add("@numfac", SqlDbType.Char, 10).Value = BE.numfac; //cmd.Parameters.Add("@fechfac", SqlDbType.DateTime).Value = BE.fechfac; cmd.Parameters.Add("@tipnotac", SqlDbType.Char, 2).Value = BE.tipnotac; cmd.Parameters.Add("@sernotac", SqlDbType.Char, 4).Value = BE.sernotac; cmd.Parameters.Add("@numnotac", SqlDbType.Char, 10).Value = BE.numnotac; cmd.Parameters.Add("@tipguia", SqlDbType.Char, 2).Value = BE.tipguia; cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid; cmd.Parameters.Add("@ubige", SqlDbType.Char, 6).Value = BE.ubige; cmd.Parameters.Add("@cencosid", SqlDbType.Char, 5).Value = BE.cencosid; //cmd.Parameters.Add("@dscto3", SqlDbType.Decimal).Value = BE.dscto3; //cmd.Parameters.Add("@totdscto1", SqlDbType.Decimal).Value = BE.totdscto1; //cmd.Parameters.Add("@totdscto2", SqlDbType.Decimal).Value = BE.totdscto2; //cmd.Parameters.Add("@totdscto3", SqlDbType.Decimal).Value = BE.totdscto3; cmd.Parameters.Add("@condpago", SqlDbType.Char, 4).Value = BE.condpago; //cmd.Parameters.Add("@transporte", SqlDbType.Decimal).Value = BE.transporte; //cmd.Parameters.Add("@embalaje", SqlDbType.Decimal).Value = BE.embalaje; //cmd.Parameters.Add("@otros", SqlDbType.Decimal).Value = BE.otros; cmd.Parameters.Add("@tipimptoid", SqlDbType.Char, 1).Value = BE.tipimptoid; //cmd.Parameters.Add("@igv", SqlDbType.Decimal).Value = BE.igv; cmd.Parameters.Add("@incprec", SqlDbType.Char, 1).Value = BE.incprec; cmd.Parameters.Add("@tipoperimptoid", SqlDbType.Char, 1).Value = BE.tipoperimptoid; //cmd.Parameters.Add("@totimpto", SqlDbType.Decimal).Value = BE.totimpto; //cmd.Parameters.Add("@valventa", SqlDbType.Decimal).Value = BE.valventa; //cmd.Parameters.Add("@totimporte", SqlDbType.Decimal).Value = BE.totimporte; //cmd.Parameters.Add("@bruto", SqlDbType.Decimal).Value = BE.bruto; //cmd.Parameters.Add("@cargo", SqlDbType.Decimal).Value = BE.cargo; //cmd.Parameters.Add("@abono", SqlDbType.Decimal).Value = BE.abono; //cmd.Parameters.Add("@tcamb", SqlDbType.Decimal).Value = BE.tcamb; cmd.Parameters.Add("@codctadebe", SqlDbType.Char, 10).Value = BE.codctadebe; cmd.Parameters.Add("@codctahaber", SqlDbType.Char, 10).Value = BE.codctahaber; cmd.Parameters.Add("@glosa", SqlDbType.VarChar, 40).Value = BE.glosa; //cmd.Parameters.Add("@totpzas", SqlDbType.Decimal).Value = BE.totpzas; //cmd.Parameters.Add("@fechentrega", SqlDbType.DateTime).Value = BE.fechentrega; //cmd.Parameters.Add("@fechpago", SqlDbType.DateTime).Value = BE.fechpago; //cmd.Parameters.Add("@fechcancel", SqlDbType.DateTime).Value = BE.fechcancel; cmd.Parameters.Add("@moneda", SqlDbType.Char).Value = BE.moneda; cmd.Parameters.Add("@statborrado", SqlDbType.Char, 1).Value = BE.statborrado; cmd.Parameters.Add("@transpid", SqlDbType.Char, 5).Value = BE.transpid; cmd.Parameters.Add("@transpnume", SqlDbType.VarChar, 40).Value = BE.transpnume; cmd.Parameters.Add("@transnmruc", SqlDbType.Char, 11).Value = BE.transnmruc; cmd.Parameters.Add("@placa", SqlDbType.VarChar, 50).Value = BE.placa; cmd.Parameters.Add("@certificado", SqlDbType.VarChar, 50).Value = BE.certificado; cmd.Parameters.Add("@licencia", SqlDbType.Char, 11).Value = BE.licencia; cmd.Parameters.Add("@motivotrasladoid", SqlDbType.Char, 1).Value = BE.motivotrasladoid; cmd.Parameters.Add("@modofactu", SqlDbType.Char, 1).Value = BE.modofactu; cmd.Parameters.Add("@clientetipo", SqlDbType.Char, 1).Value = BE.clientetipo; cmd.Parameters.Add("@ddnni", SqlDbType.Char, 8).Value = BE.ddnni; //cmd.Parameters.Add("@items", SqlDbType.Decimal).Value = BE.items; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio; cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = BE.perimes; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Movimientoscab_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc; cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc; cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@diarioid", SqlDbType.Char, 4).Value = BE.diarioid; cmd.Parameters.Add("@asiento", SqlDbType.Char, 6).Value = BE.asiento; cmd.Parameters.Add("@almacaccionid", SqlDbType.Char, 2).Value = BE.almacaccionid; cmd.Parameters.Add("@tipoperacionid", SqlDbType.Char, 2).Value = BE.tipoperacionid; cmd.Parameters.Add("@ctacteaccionid", SqlDbType.Char, 2).Value = BE.ctacteaccionid; cmd.Parameters.Add("@fechdoc", SqlDbType.DateTime).Value = BE.fechdoc; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename; cmd.Parameters.Add("@direcnume", SqlDbType.Char, 6).Value = BE.direcnume; cmd.Parameters.Add("@direcname", SqlDbType.VarChar, 25).Value = BE.direcname; cmd.Parameters.Add("@direcdeta", SqlDbType.VarChar, 70).Value = BE.direcdeta; cmd.Parameters.Add("@direc", SqlDbType.VarChar, 70).Value = BE.direc; cmd.Parameters.Add("@tipdid", SqlDbType.Char, 1).Value = BE.tipdid; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc; cmd.Parameters.Add("@tipref", SqlDbType.Char, 2).Value = BE.tipref; cmd.Parameters.Add("@serref", SqlDbType.Char, 4).Value = BE.serref; cmd.Parameters.Add("@numref", SqlDbType.Char, 10).Value = BE.numref; cmd.Parameters.Add("@fechref", SqlDbType.DateTime).Value = BE.fechref; cmd.Parameters.Add("@tip_op", SqlDbType.Char, 2).Value = BE.tip_op; cmd.Parameters.Add("@ser_op", SqlDbType.Char, 4).Value = BE.ser_op; cmd.Parameters.Add("@num_op", SqlDbType.Char, 10).Value = BE.num_op; cmd.Parameters.Add("@tipfac", SqlDbType.Char, 2).Value = BE.tipfac; cmd.Parameters.Add("@serfac", SqlDbType.Char, 4).Value = BE.serfac; cmd.Parameters.Add("@numfac", SqlDbType.Char, 10).Value = BE.numfac; cmd.Parameters.Add("@fechfac", SqlDbType.DateTime).Value = BE.fechfac; cmd.Parameters.Add("@tipguia", SqlDbType.Char, 2).Value = BE.tipguia; cmd.Parameters.Add("@serguia", SqlDbType.Char, 4).Value = BE.serguia; cmd.Parameters.Add("@numguia", SqlDbType.Char, 10).Value = BE.numguia; cmd.Parameters.Add("@fechguia", SqlDbType.DateTime).Value = BE.fechguia; cmd.Parameters.Add("@tipnotac", SqlDbType.Char, 2).Value = BE.tipnotac; cmd.Parameters.Add("@sernotac", SqlDbType.Char, 4).Value = BE.sernotac; cmd.Parameters.Add("@numnotac", SqlDbType.Char, 10).Value = BE.numnotac; cmd.Parameters.Add("@fechnotac", SqlDbType.DateTime).Value = BE.fechnotac; cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid; cmd.Parameters.Add("@ubige", SqlDbType.Char, 6).Value = BE.ubige; cmd.Parameters.Add("@cencosid", SqlDbType.Char, 5).Value = BE.cencosid; cmd.Parameters.Add("@dscto3", SqlDbType.Decimal).Value = BE.dscto3; cmd.Parameters.Add("@totdscto1", SqlDbType.Decimal).Value = BE.totdscto1; cmd.Parameters.Add("@totdscto2", SqlDbType.Decimal).Value = BE.totdscto2; cmd.Parameters.Add("@totdscto3", SqlDbType.Decimal).Value = BE.totdscto3; cmd.Parameters.Add("@condpago", SqlDbType.Char, 4).Value = BE.condpago; cmd.Parameters.Add("@transporte", SqlDbType.Decimal).Value = BE.transporte; cmd.Parameters.Add("@embalaje", SqlDbType.Decimal).Value = BE.embalaje; cmd.Parameters.Add("@otros", SqlDbType.Decimal).Value = BE.otros; cmd.Parameters.Add("@tipimptoid", SqlDbType.Char, 1).Value = BE.tipimptoid; cmd.Parameters.Add("@igv", SqlDbType.Decimal).Value = BE.igv; cmd.Parameters.Add("@incprec", SqlDbType.Char, 1).Value = BE.incprec; cmd.Parameters.Add("@tipoperimptoid", SqlDbType.Char, 1).Value = BE.tipoperimptoid; cmd.Parameters.Add("@totimpto", SqlDbType.Decimal).Value = BE.totimpto; cmd.Parameters.Add("@valventa", SqlDbType.Decimal).Value = BE.valventa; cmd.Parameters.Add("@totimporte", SqlDbType.Decimal).Value = BE.totimporte; cmd.Parameters.Add("@bruto", SqlDbType.Decimal).Value = BE.bruto; cmd.Parameters.Add("@cargo", SqlDbType.Decimal).Value = BE.cargo; cmd.Parameters.Add("@abono", SqlDbType.Decimal).Value = BE.abono; cmd.Parameters.Add("@tcamb", SqlDbType.Decimal).Value = BE.tcamb; cmd.Parameters.Add("@codctadebe", SqlDbType.Char, 10).Value = BE.codctadebe; cmd.Parameters.Add("@codctahaber", SqlDbType.Char, 10).Value = BE.codctahaber; cmd.Parameters.Add("@glosa", SqlDbType.VarChar, 40).Value = BE.glosa; cmd.Parameters.Add("@totpzas", SqlDbType.Decimal).Value = BE.totpzas; cmd.Parameters.Add("@fechentrega", SqlDbType.DateTime).Value = BE.fechentrega; cmd.Parameters.Add("@fechpago", SqlDbType.DateTime).Value = BE.fechpago; cmd.Parameters.Add("@fechcancel", SqlDbType.DateTime).Value = BE.fechcancel; cmd.Parameters.Add("@moneda", SqlDbType.Char).Value = BE.moneda; cmd.Parameters.Add("@statborrado", SqlDbType.Char, 1).Value = BE.statborrado; cmd.Parameters.Add("@transpid", SqlDbType.Char, 5).Value = BE.transpid; cmd.Parameters.Add("@transpnume", SqlDbType.VarChar, 40).Value = BE.transpname; cmd.Parameters.Add("@motivotrasladoid", SqlDbType.Char, 2).Value = BE.motivotrasladoid; cmd.Parameters.Add("@mottrasladointid", SqlDbType.Char, 2).Value = BE.mottrasladointid; cmd.Parameters.Add("@modofactu", SqlDbType.Char, 1).Value = BE.modofactu; cmd.Parameters.Add("@clientetipo", SqlDbType.Char, 1).Value = BE.clientetipo; cmd.Parameters.Add("@ddnni", SqlDbType.Char, 8).Value = BE.ddnni; cmd.Parameters.Add("@items", SqlDbType.Decimal).Value = BE.items; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio; cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = BE.perimes; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetAll_paginacion(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Movimientoscab_SEARCH_paginacion", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc; cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc; cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@posicion", SqlDbType.VarChar, 10).Value = BE.posicion; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_60movimientoscab BE) { return tablaDA.Update(empresaid, BE); }
private void RecibeRollos(DataTable dtresultado) { string prodid = ""; try { if (dtresultado.Rows.Count > 0) { var cont = 0; foreach (DataRow fila in dtresultado.Rows) { cont = cont + 1; if (griddetallemov.Rows.Count > 0) { var nFilaAnt = griddetallemov.RowCount - 1; var xProductid = fila["productid"].ToString(); var xRollo = fila["rollo"].ToString(); var xProductname = fila["productname"].ToString(); var xActivo = Convert.ToBoolean(fila["check"].ToString()); Decimal xPrecio = 0; if (xActivo) { xPrecio = Convert.ToDecimal(fila["precio"].ToString()); } var xnserie = string.Empty; if (modulo == "0500") { xnserie = fila["nserie"].ToString(); } if (cont > 1) { Tabladetallemov.Rows.Add(VariablesPublicas.InsertIntoTable(Tabladetallemov)); Tabladetallemov.Rows[Tabladetallemov.Rows.Count - 1]["items"] = VariablesPublicas.CalcMaxField(Tabladetallemov, "items", 5); griddetallemov.Rows[nFilaAnt + 1].Cells["productid"].Value = xProductid; griddetallemov.Rows[nFilaAnt + 1].Cells["productname"].Value = xProductname; } else { griddetallemov.Rows[nFilaAnt].Cells["productid"].Value = xProductid; griddetallemov.Rows[nFilaAnt].Cells["productname"].Value = xProductname; if (modulo == "0500") { griddetallemov.Rows[nFilaAnt].Cells["nserie"].Value = xnserie; } } prodid = xProductid.ToString(); griddetallemov.CurrentCell = griddetallemov.Rows[griddetallemov.RowCount - 1].Cells["cantidad"]; griddetallemov.BeginEdit(true); if (xActivo) { ValidaTablaDetalle(xRollo, xPrecio); } else { ValidaTabladetallemovmov(xRollo); } } } } var BL_ = new tb_60movimientosBL(); var BE_ = new tb_60movimientoscab(); DataTable dt = new DataTable(); BE_.tip_op = "OP"; BE_.ser_op = ser_op.Text.Trim().PadLeft(4, '0'); BE_.num_op = num_op.Text.Trim().PadLeft(10, '0'); BE_.productoid = prodid.ToString(); BE_.moduloid = modulo.Trim().ToString(); BE_.idx = "ONE"; dt = BL_.GetvalidaMov(EmpresaID, BE_).Tables[0]; string arows = dt.Rows[0].Field<string>("Idx"); //if (arows == "0") //{ // MessageBox.Show("El Producto seleccionado no pertenece a la OP N°: " + ser_op.Text + "-" + num_op.Text + // ", \n Verificar OP ", "Confirmación", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //} } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet GetOne2(string empresaid, tb_60movimientoscab BE) { return tablaDA.GetOne2(empresaid, BE); }
private void ValidaTabladetallemovmov(String valrollo) { var xrollo = string.Empty; var xproductid = string.Empty; Decimal xpreciorollo = 0, xprecunit = 0, xcantidad = 0, xcostoprom = 0, tipcamb = 0; Decimal desct1 = 0; Decimal imporfac = 0; Decimal import = 0; Decimal totimpx = 0; xrollo = valrollo.Trim(); var rowrollo = Tabladetallemov.Select("rollo='" + xrollo + "'"); if (rowrollo.Length > 0) { MessageBox.Show("Rollo ya existe !!!!!!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txt_stock.Text = "0"; txt_valor.Text = "0"; var BLR = new tb_ta_prodrolloBL(); var DTR = new DataTable(); DTR = BLR.GetOne(EmpresaID, xrollo).Tables[0]; if (DTR.Rows.Count > 0) { xproductid = DTR.Rows[0]["productid"].ToString(); if (xproductid.Trim().Length == 13) { var BL = new tb_60local_stockBL(); var BE = new tb_60local_stock(); var DT = new DataTable(); BE.moduloid = modulo; BE.productid = xproductid; DT = BL.GetAll(EmpresaID, BE).Tables[0]; var nrow = griddetallemov.CurrentCell.RowIndex; if (DT.Rows.Count > 0) { griddetallemov.Rows[nrow].Cells["productid"].Value = DT.Rows[0]["productid"].ToString().Trim(); griddetallemov.Rows[nrow].Cells["productname"].Value = DT.Rows[0]["productname"].ToString().Trim(); griddetallemov.Rows[nrow].Cells["rollo"].Value = DTR.Rows[0]["rollo"].ToString().Trim(); griddetallemov.Rows[nrow].Cells["stock"].Value = Convert.ToDecimal(DTR.Rows[0]["rollostock"].ToString().Trim().PadLeft(1, '0')); griddetallemov.Rows[nrow].Cells["dalmacaccionid"].Value = almacaccionid.ToString().Trim(); txt_stock.Text = Math.Round(Convert.ToDecimal(DTR.Rows[0]["rollostock"].ToString().Trim().PadLeft(1, '0')), 2).ToString(); if (almacaccionid.Substring(0, 1) == "2") { xprecventa = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["precventa"]).ToString("###,###,##0.000000")); xpreciorollo = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); txt_valor.Text = Convert.ToDecimal(DT.Rows[0]["costopromed"].ToString().Trim().PadLeft(1, '0')).ToString("###,###,##0.0000"); xcostoprom = Convert.ToDecimal(DT.Rows[0]["costopromed"].ToString().Trim().PadLeft(1, '0')); } else { if (almacaccionid.Substring(0, 1) == "1") { xcostoultimo = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); xpreciorollo = Convert.ToDecimal(Convert.ToDecimal(DT.Rows[0]["costoultimo"]).ToString("###,###,##0.000000")); txt_valor.Text = Convert.ToDecimal(DT.Rows[0]["costoultimo"].ToString().Trim().PadLeft(1, '0')).ToString("###,###,##0.0000"); } } griddetallemov.Rows[nrow].Cells["precventa"].Value = xprecventa; griddetallemov.Rows[nrow].Cells["costoultimo"].Value = xcostoultimo; griddetallemov.Rows[nrow].Cells["costopromed"].Value = xcostoprom; var BL_ = new tb_60movimientosBL(); var BE_ = new tb_60movimientoscab(); DataTable dt = new DataTable(); BE_.tip_op = "OP"; BE_.ser_op = ser_op.Text.Trim().PadLeft(4, '0'); BE_.num_op = num_op.Text.Trim().PadLeft(10, '0'); BE_.productoid = DT.Rows[0]["productid"].ToString().Trim(); BE_.moduloid = modulo.Trim().ToString(); BE_.idx = "ONE"; dt = BL_.GetvalidaMov(EmpresaID, BE_).Tables[0]; string arows = dt.Rows[0].Field<string>("Idx"); //if (arows == "0") //{ // MessageBox.Show("El Producto seleccionado no pertenece a la OP N°: " + ser_op.Text + "-" + num_op.Text + // ", \n Verificar OP ", "Confirmación", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //} if (tipoperacionid.SelectedValue.ToString() == "02") { xcantidad = Convert.ToDecimal(DTR.Rows[0]["rollomedcompra"].ToString().Trim().PadLeft(1, '0')); } else { xcantidad = Convert.ToDecimal(DTR.Rows[0]["rollostock"].ToString().Trim().PadLeft(1, '0')); } tipcamb = Convert.ToDecimal(tcamb.Text.Trim()); if (tipcamb <= 0) { tipcamb = 1; } if (moneda.SelectedValue.ToString() == "S") { xprecunit = xpreciorollo; } else { xprecunit = xpreciorollo / tipcamb; } if (tipoperacionid.SelectedValue.ToString() == "02" && Convert.ToDecimal(DTR.Rows[0]["rollovaloractual"].ToString().Trim().PadLeft(1, '0')) > 0) { xprecunit = Convert.ToDecimal(DTR.Rows[0]["rollovaloractual"].ToString().Trim().PadLeft(1, '0')); } imporfac = Math.Round(xcantidad * Convert.ToDecimal(xprecunit), 6); _cal_Igv(); desct1 = 0; import = imporfac * (1 - (desct1 / 100)); if (incprec.Trim() == "S") { totimpx = Math.Round(import * (Convert.ToDecimal(igv) / (100 + Convert.ToDecimal(igv))), 6); } else { totimpx = Math.Round(import * (Convert.ToDecimal(igv) / 100), 6); } griddetallemov.Rows[nrow].Cells["valor"].Value = xpreciorollo; griddetallemov.Rows[nrow].Cells["importe"].Value = Math.Round(xcantidad * xpreciorollo, 6); griddetallemov.Rows[nrow].Cells["dtotimpto"].Value = totimpx; griddetallemov.Rows[nrow].Cells["cantidad"].Value = xcantidad; griddetallemov.Rows[nrow].Cells["precunit"].Value = xprecunit; griddetallemov.Rows[nrow].Cells["importfac"].Value = Math.Round(imporfac, 2); Tabladetallemov.AcceptChanges(); griddetallemov.CurrentCell = griddetallemov.Rows[nrow].Cells["cantidad"]; } 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); } } else { MessageBox.Show("Rollo no Existe !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void form_cargar_datos2(String posicion, String tipdocalt, String numdocalt) { try { var BL = new tb_60movimientoscabBL(); var BE = new tb_60movimientoscab(); var dt = new DataTable(); BE.moduloid = modulo; BE.local = local; BE.tipodoc = tipdocalt.ToString(); if (serdoc.Text.Trim().Length > 0) { BE.serdoc = serdoc.Text.Trim().PadLeft(4, '0'); BE.numdoc = numdocalt.ToString(); } else { if (posicion.Trim().Length > 0) { MessageBox.Show("Seleccionar el Tipo de Documento !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } if (numdocalt.ToString().Length > 0) { BE.numdoc = numdocalt.ToString(); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { data_cbo_tiporeferencia(almacaccionid); fechdoc.Text = dt.Rows[0]["fechdoc"].ToString().Trim(); tipimptoid = dt.Rows[0]["tipimptoid"].ToString().Trim(); direcnume = dt.Rows[0]["direcnume"].ToString().Trim(); incprec = dt.Rows[0]["incprec"].ToString().Trim(); moneda.SelectedValue = dt.Rows[0]["moneda"].ToString().Trim(); txtmoneda.Text = dt.Rows[0]["moneda"].ToString().Trim(); tcamb.Text = dt.Rows[0]["tcamb"].ToString().Trim(); if (dt.Rows[0]["tipimptoid"].ToString().Trim().Length > 0) { tipimptotasa.SelectedValue = dt.Rows[0]["tipimptoid"].ToString().Trim(); } else { tipimptotasa.SelectedIndex = -1; } ctacte.Text = dt.Rows[0]["ctacte"].ToString().Trim(); nmruc.Text = dt.Rows[0]["nmruc"].ToString().Trim(); ctactename.Text = dt.Rows[0]["ctactename"].ToString().Trim(); direc.Text = dt.Rows[0]["direc"].ToString().Trim(); if (dt.Rows[0]["mottrasladointid"].ToString().Trim().Length > 0 && dt.Rows[0]["mottrasladointid"].ToString().Trim() != "00") { mottrasladointid.SelectedValue = dt.Rows[0]["mottrasladointid"].ToString().Trim(); } else { mottrasladointid.SelectedIndex = -1; } direcname.Text = dt.Rows[0]["direcname"].ToString().Trim(); direcdeta.Text = dt.Rows[0]["direcdeta"].ToString().Trim(); if (dt.Rows[0]["tipoperacionid"].ToString().Trim().Length > 0) { tipoperacionid.SelectedValue = dt.Rows[0]["tipoperacionid"].ToString().Trim(); } else { tipoperacionid.SelectedIndex = -1; } if (dt.Rows[0]["motivotrasladoid"].ToString().Trim().Length > 0 & dt.Rows[0]["motivotrasladoid"].ToString().Trim() != "00") { motivotrasladoid.SelectedValue = dt.Rows[0]["motivotrasladoid"].ToString().Trim(); } else { motivotrasladoid.SelectedIndex = -1; } if (dt.Rows[0]["tipref"].ToString().Trim().Length > 0 && dt.Rows[0]["serref"].ToString().Trim().Length > 0) { tipref.SelectedValue = dt.Rows[0]["tipref"].ToString().Trim(); serref.Text = dt.Rows[0]["serref"].ToString().Trim(); var n = dt.Rows[0]["numref"].ToString().Trim(); numdococ1.Text = Equivalencias.Left(n, 4); numdococ.Text = Equivalencias.Right(n, 6); fechref.Format = DateTimePickerFormat.Short; fechref.Text = dt.Rows[0]["fechref"].ToString().Trim(); } else { tipref.SelectedIndex = -1; } if (dt.Rows[0]["serfac"].ToString().Trim().Length > 0 && dt.Rows[0]["numfac"].ToString().Trim().Length > 0) { tipfac.SelectedValue = dt.Rows[0]["tipfac"].ToString().Trim(); serfac.Text = dt.Rows[0]["serfac"].ToString().Trim(); numfac.Text = dt.Rows[0]["numfac"].ToString().Trim(); fechfac.Format = DateTimePickerFormat.Short; fechfac.Text = dt.Rows[0]["fechfac"].ToString().Trim(); } else { tipfac.SelectedIndex = 0; } if (dt.Rows[0]["serguia"].ToString().Trim().Length > 0 && dt.Rows[0]["numguia"].ToString().Trim().Length > 0) { serguia.Text = dt.Rows[0]["serguia"].ToString().Trim(); numguia.Text = dt.Rows[0]["numguia"].ToString().Trim(); fechguia.Format = DateTimePickerFormat.Short; fechguia.Text = dt.Rows[0]["fechguia"].ToString().Trim(); } if (dt.Rows[0]["sernotac"].ToString().Trim().Length > 0 && dt.Rows[0]["numnotac"].ToString().Trim().Length > 0) { sernotac.Text = dt.Rows[0]["sernotac"].ToString().Trim(); numnotac.Text = dt.Rows[0]["numnotac"].ToString().Trim(); fechnotac.Format = DateTimePickerFormat.Short; fechnotac.Text = dt.Rows[0]["fechnotac"].ToString().Trim(); } if (dt.Rows[0]["ser_op"].ToString().Trim().Length > 0 && dt.Rows[0]["num_op"].ToString().Trim().Length > 0) { ser_op.Text = dt.Rows[0]["ser_op"].ToString().Trim(); num_op.Text = dt.Rows[0]["num_op"].ToString().Trim(); } ValidaCentroCosto(dt.Rows[0]["cencosid"].ToString(), true); estacion.Text = dt.Rows[0]["estacion"].ToString(); ValidaPersona(dt.Rows[0]["perdni"].ToString(), true); if (dt.Rows[0]["fechentrega"].ToString().Trim().Substring(0, 10) != "01/01/1900") { fechentrega.Format = DateTimePickerFormat.Short; fechentrega.Text = dt.Rows[0]["fechentrega"].ToString().Trim(); } if (dt.Rows[0]["fechpago"].ToString().Trim().Substring(0, 10) != "01/01/1900") { fechpago.Format = DateTimePickerFormat.Short; fechpago.Text = dt.Rows[0]["fechpago"].ToString().Trim(); } ValidaTransportista(dt.Rows[0]["transpid"].ToString(), false); ddnni.Text = dt.Rows[0]["ddnni"].ToString().Trim(); itemsT.Text = dt.Rows[0]["items"].ToString().Trim(); totpzas.Text = dt.Rows[0]["totpzas"].ToString().Trim(); bruto.Text = dt.Rows[0]["bruto"].ToString().Trim(); totdscto1.Text = dt.Rows[0]["totdscto1"].ToString().Trim(); valventa.Text = dt.Rows[0]["valventa"].ToString().Trim(); totimpto.Text = dt.Rows[0]["totimpto"].ToString().Trim(); totimporte.Text = dt.Rows[0]["totimporte"].ToString().Trim(); glosa.Text = dt.Rows[0]["glosa"].ToString().Trim(); DetalleMovimiento(tipdocalt.ToString(), numdocalt.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected internal void numguia_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { var num = string.Empty; num = numguia.Text.ToString().PadLeft(10, '0'); numguia.Text = num; var BL = new tb_60movimientoscabBL(); var BE = new tb_60movimientoscab(); var dt = new DataTable(); BE.moduloid = moduloiddes.SelectedValue.ToString(); BE.local = localdes.SelectedValue.ToString(); BE.tipodoc = tipguia.Text.ToString(); BE.serdoc = serguia.Text.ToString(); BE.numdoc = numguia.Text; dt = BL.GetAll2(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { if (dt.Rows[0]["moneda"].ToString() == "S") { MessageBox.Show("Documento de referencia no puede ser en Moneda Nacional, verifique ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var xfechdoc = Convert.ToDateTime(dt.Rows[0]["fechdoc"]); if (Convert.ToString(xfechdoc.Year) != serdoc.Text.ToString().Trim()) { MessageBox.Show("Documento de Referencia NO ES DEL PERIODO ACTUAL, verifique ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tipfac.Text = dt.Rows[0]["tipfac"].ToString(); serfac.Text = dt.Rows[0]["serfac"].ToString(); numfac.Text = dt.Rows[0]["numfac"].ToString(); tipref.Text = dt.Rows[0]["tipref"].ToString(); numdococ1.Text = Equivalencias.Left(dt.Rows[0]["numref"].ToString(), 4); numdococ.Text = Equivalencias.Right(dt.Rows[0]["numref"].ToString(), 6); ctacte.Text = dt.Rows[0]["ctacte"].ToString(); ctactename.Text = dt.Rows[0]["ctactename"].ToString(); _validaPais(); } else { MessageBox.Show("NO SE UBICÓ documento de referencia ó se encuentra ANULADO, verifique ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _CargarDetalle(); if (dt.Rows.Count > 0) { for (var i = 0; i < dgb_importacion1.RowCount ; i++) { var codi = dgb_importacion1.GetRowCellValue(i, "conceptoid").ToString(); if (codi.Trim() == "101") { dgb_importacion1.SetRowCellValue(i, "ctacte", dt.Rows[0]["ctacte"].ToString()); dgb_importacion1.SetRowCellValue(i, "proveedor", dt.Rows[0]["ctactename"].ToString()); dgb_importacion1.SetRowCellValue(i, "tipbou", dt.Rows[0]["tipfac"].ToString()); dgb_importacion1.SetRowCellValue(i, "serbou", dt.Rows[0]["serfac"].ToString()); dgb_importacion1.SetRowCellValue(i, "numbou", dt.Rows[0]["numfac"].ToString()); dgb_importacion1.SetRowCellValue(i, "fechbou", dt.Rows[0]["fechfac"].ToString()); dgb_importacion1.SetRowCellValue(i, "tipcamb", dt.Rows[0]["tcamb"].ToString()); dgb_importacion1.SetRowCellValue(i, "migv", dt.Rows[0]["igv"].ToString()); dgb_importacion1.SetRowCellValue(i, "bimp_sunat2", dt.Rows[0]["valventa"].ToString()); Decimal ximp_me = 0; Decimal ximp_mn = 0; Decimal xtcamb = 0; ximp_me = Convert.ToDecimal(dt.Rows[0]["valventa"].ToString()); xtcamb = Convert.ToDecimal(dt.Rows[0]["tcamb"].ToString()); xvalventa = (ximp_me * xtcamb) + ximp_mn; dgb_importacion1.SetRowCellValue(i, "pven", xvalventa); } } } else { limpiar_documento(); } dgb_importacion1.Focus(); } }
private void btn_grabar_Click(object sender, EventArgs e) { var sw_prosigue = false; if (ssModo == "NEW") { if (XNIVEL == "0" || XNIVEL == "1" || XNIVEL == "2") { sw_prosigue = (MessageBox.Show("¿Desea Guardar Documento actual ?", "Mensaje del Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes); } string prodid = ""; if (sw_prosigue) { DataTable dt = new DataTable(); dt.Columns.Add("productid", typeof(System.String)); foreach (DataGridViewRow rowGrid in griddetallemov.Rows) { DataRow row = dt.NewRow(); row["productid"] = Convert.ToString(rowGrid.Cells[1].Value); prodid = prodid+row["productid"].ToString(); dt.Rows.Add(row); } var BL_ = new tb_60movimientosBL(); var BE_ = new tb_60movimientoscab(); DataTable dt_ = new DataTable(); BE_.tip_op = "OP"; BE_.ser_op = ser_op.Text.Trim().PadLeft(4, '0'); BE_.num_op = num_op.Text.Trim().PadLeft(10, '0'); BE_.productoid = prodid.ToString(); BE_.moduloid = modulo.Trim().ToString(); BE_.idx = "ALL"; dt_ = BL_.GetvalidaMov(EmpresaID, BE_).Tables[0]; string arows = dt_.Rows[0].Field<string>("Idx"); //if (arows == "0") //{ // MessageBox.Show("Algunos Productos de la lista no corresponden\n a la OP N°: " + ser_op.Text + "-" + num_op.Text + // ", Verificar OP ", "Confirmación", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //}else //{ Insert(); //} } } else { if (XNIVEL == "0" || XNIVEL == "1") { sw_prosigue = (MessageBox.Show("¿Desea Modificar Documento actual ?", "Mensaje del Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes); if (sw_prosigue) { Update(); } } } }
public DataSet GetvalidaMov(string empresaid, tb_60movimientoscab BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaMovimientosprod", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipop", SqlDbType.Char, 2).Value = BE.tip_op; cmd.Parameters.Add("@serop", SqlDbType.Char, 4).Value = BE.ser_op; cmd.Parameters.Add("@numop", SqlDbType.Char, 10).Value = BE.num_op; cmd.Parameters.Add("@productoid", SqlDbType.VarChar).Value = BE.productoid; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@Idx", SqlDbType.Char, 3).Value = BE.idx; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }