protected void BindConsingnacion() { DataTable DT = new DataTable(); Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "SP_PANTALLA_Sal_consignacion 1,@Bod, @Us,'','',0,0,0, @ICC,'01-1-2009','01-01-1900','01-01-1900'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@Bod", DdlBodega.Text.Trim()); SC.Parameters.AddWithValue("@Us", Session["C77U"]); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); using (SqlDataAdapter SDA = new SqlDataAdapter()) { SDA.SelectCommand = SC; SDA.Fill(DT); if (DT.Rows.Count > 0) { GrdDetalle.DataSource = DT; GrdDetalle.DataBind(); BtnEntregar.Enabled = true; } else { GrdDetalle.DataSource = null; GrdDetalle.DataBind(); BtnEntregar.Enabled = false; } /**/ } } } }
protected void btnActualiza_Click(object sender, EventArgs e) { lblError.Text = ""; Button boton = (Button)sender; string[] argumentos = boton.CommandArgument.ToString().Split(new char[] { ';' }); string estatus = "A"; if (argumentos[1] == "A") { estatus = "F"; } else { estatus = "A"; } Inventario orden = new Inventario(); object[] actualizado = orden.actualizaEstatus(Convert.ToInt32(argumentos[0]), Convert.ToInt32(ddlIslas.SelectedValue), estatus); if (Convert.ToBoolean(actualizado[0])) { GridFactPend.DataBind(); GrdDetalle.DataBind(); } else { lblError.Text = "Error: " + Convert.ToString(actualizado[1]); } }
protected void BindDBodg(string CodB, string Accion) { Idioma = (DataTable)ViewState["TablaIdioma"]; DataRow[] Result; if (Accion.Equals("UPD")) { Cnx.SelecBD(); using (SqlConnection sqlCon = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_PANTALLA_Bodega 2, '','','','WEB',0,0,0,@ICC,'01-1-2009','01-01-1900','01-01-1900'"; sqlCon.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlCon)) { SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); SqlDataAdapter SDA = new SqlDataAdapter(); SDA.SelectCommand = SC; SDA.Fill(DTDet); ViewState["DTDet"] = DTDet; } } } DTDet = (DataTable)ViewState["DTDet"]; DataTable DT = new DataTable(); DT = DTDet.Clone(); Result = DTDet.Select("CodBodega = '" + CodB.Trim() + "'"); foreach (DataRow DR in Result) { DT.ImportRow(DR); } if (DT.Rows.Count > 0) { DataView DV = DT.DefaultView; DV.Sort = "Columna,Fila"; DT = DV.ToTable(); GrdDetalle.DataSource = DT; GrdDetalle.DataBind(); } else { DT.Rows.Add(DT.NewRow()); GrdDetalle.DataSource = DT; GrdDetalle.DataBind(); GrdDetalle.Rows[0].Cells.Clear(); GrdDetalle.Rows[0].Cells.Add(new TableCell()); Result = Idioma.Select("Objeto= 'SinRegistros'"); foreach (DataRow row in Result) { GrdDetalle.Rows[0].Cells[0].Text = row["Texto"].ToString(); } GrdDetalle.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } }
protected void DdlBodega_TextChanged(object sender, EventArgs e) { if (DdlBodega.Text.Trim().Equals("")) { BtnEntregar.Enabled = false; GrdDetalle.DataSource = null; GrdDetalle.DataBind(); } else { BtnEntregar.Enabled = true; BindConsingnacion(); } }
protected void DdlPpt_TextChanged(object sender, EventArgs e) { if (DdlPpt.Text.Trim().Equals("0")) { BtnIngresar.Enabled = false; LblCliente.Text = ""; } DataTable DT = new DataTable(); Cnx.SelecBD(); using (SqlConnection sqlConB = new SqlConnection(Cnx.GetConex())) { string VbTxtSql = "EXEC SP_PANTALLA_PropuestaEntregaElem 4,@Us,'','','',@PT,0,@ICC,0,'01-1-2009','01-01-1900','01-01-1900'"; sqlConB.Open(); using (SqlCommand SC = new SqlCommand(VbTxtSql, sqlConB)) { SC.Parameters.AddWithValue("@Us", Session["C77U"]); SC.Parameters.AddWithValue("@ICC", Session["!dC!@"]); SC.Parameters.AddWithValue("@PT", DdlPpt.Text.Trim()); using (SqlDataAdapter SDA = new SqlDataAdapter()) { SDA.SelectCommand = SC; SDA.Fill(DT); if (DT.Rows.Count > 0) { GrdDetalle.DataSource = DT; GrdDetalle.DataBind(); BtnIngresar.Enabled = true; DSTDdl = (DataSet)ViewState["DSTDdl"]; DataRow[] Result = DSTDdl.Tables[0].Select("IdPropuesta=" + DdlPpt.Text.Trim()); foreach (DataRow Row in Result) { ViewState["CodTercero"] = Row["CodTercero"].ToString().Trim(); LblCliente.Text = "[" + Row["CodTercero"].ToString().Trim() + "] - [" + Row["RazonSocial"].ToString().Trim() + "]"; } } else { GrdDetalle.DataSource = null; GrdDetalle.DataBind(); BtnIngresar.Enabled = false; LblCliente.Text = ""; } } } } }
//************************ GridView Detalle ****************************** protected void BindDDetTmp() { TblDetalle = (DataTable)ViewState["TblDetalle"]; int VbNumReg = TblDetalle.Rows.Count; TblDetalle.AcceptChanges(); foreach (DataRow row in TblDetalle.Rows) { object value = row["CodBodega"]; if (value == DBNull.Value) { if (VbNumReg > 1) { row.Delete(); BtnIngresar.Enabled = true; } } } TblDetalle.AcceptChanges(); if (TblDetalle.Rows.Count > 0) { GrdDetalle.DataSource = TblDetalle; GrdDetalle.DataBind(); } else { TblDetalle.Rows.Add(TblDetalle.NewRow()); GrdDetalle.DataSource = TblDetalle; GrdDetalle.DataBind(); GrdDetalle.Rows[0].Cells.Clear(); GrdDetalle.Rows[0].Cells.Add(new TableCell()); GrdDetalle.Rows[0].Cells[0].Text = "Empty..!"; GrdDetalle.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; BtnIngresar.Enabled = false; TblDetalle.NewRow(); GrdDetalle.DataSource = TblDetalle; GrdDetalle.DataBind(); } }
protected void GridFactPend_PageIndexChanging(object sender, GridViewPageEventArgs e) { lblError.Text = ""; GrdDetalle.DataBind(); }
protected void ddlEstatus_SelectedIndexChanged(object sender, EventArgs e) { lblError.Text = ""; GridFactPend.DataBind(); GrdDetalle.DataBind(); }
protected void BtnEntregar_Click(object sender, EventArgs e) { Page.Title = ViewState["PageTit"].ToString().Trim(); Idioma = (DataTable)ViewState["TablaIdioma"]; DataRow[] Result; string VbTieneReg = "N"; if (TxtObserv.Text.Trim().Equals("")) { Result = Idioma.Select("Objeto= 'MstrMens22'"); foreach (DataRow row in Result) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + row["Texto"].ToString() + "');", true); } // return; } if (DdlCliente.Text.Trim().Equals("")) { Result = Idioma.Select("Objeto= 'MensSalConsg01'"); foreach (DataRow row in Result) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + row["Texto"].ToString() + "');", true); } //Debe seleccionar un cliente. return; } List <CsInsertElementoAlmacen> ObjDetalle = new List <CsInsertElementoAlmacen>(); foreach (GridViewRow Row in GrdDetalle.Rows) { string VbSn, VblLote; CheckBox CkbSelP = Row.FindControl("CkbSelP") as CheckBox; if (CkbSelP.Checked == true) { VbTieneReg = "S"; switch (GrdDetalle.DataKeys[Row.RowIndex].Values["IdentificadorElem"].ToString().Trim()) { case "SN": VbSn = (Row.FindControl("LblSn") as Label).Text.Trim(); VblLote = ""; break; case "LOTE": VbSn = ""; VblLote = (Row.FindControl("LblSn") as Label).Text.Trim(); break; default: VbSn = ""; VblLote = ""; break; } var TypDetalle = new CsInsertElementoAlmacen() { IdIE = Convert.ToInt32(0), CodElemento = GrdDetalle.DataKeys[Row.RowIndex].Values["CodElemento"].ToString().Trim(), CodReferencia = (Row.FindControl("LblRef") as Label).Text.Trim(), PN = (Row.FindControl("LblPn") as Label).Text.Trim(), SN = VbSn.Trim(), Lote = VblLote.Trim(), CodTipoElem = GrdDetalle.DataKeys[Row.RowIndex].Values["CodTipoElem"].ToString().Trim(), Identificador = GrdDetalle.DataKeys[Row.RowIndex].Values["IdentificadorElem"].ToString().Trim(), Descripcion = (Row.FindControl("LblDesc") as Label).Text.Trim(), Cantidad = Convert.ToDouble((Row.FindControl("LblCant") as TextBox).Text.Trim()), CantidadAnt = Convert.ToDouble((Row.FindControl("LblCantAct") as Label).Text.Trim()), Valor = Convert.ToDouble(0), CodUndMed = GrdDetalle.DataKeys[Row.RowIndex].Values["CodUndMed"].ToString().Trim(), IdAlmacen = Convert.ToInt32(GrdDetalle.DataKeys[Row.RowIndex].Values["CodIdAlmacen"].ToString().Trim()), CodBodega = GrdDetalle.DataKeys[Row.RowIndex].Values["CodBodega"].ToString().Trim(), CodShippingOrder = "", Posicion = "0", CodAeronave = Convert.ToInt32(0), Matricula = "", CCosto = "", AfectaInventario = Convert.ToInt32(0), CostoImportacion = Convert.ToInt32(0), CodTercero = DdlCliente.Text.Trim(), Consignacion = Convert.ToInt32(0), CodIdUbicacion = Convert.ToInt32(GrdDetalle.DataKeys[Row.RowIndex].Values["CodIdUbicacion"].ToString().Trim()), FechaVence = null, Observacion = TxtObserv.Text.Trim(), Proceso = "0111", // Salida consignacion IdDetPropHk = Convert.ToInt32(0), IdPPt = Convert.ToInt32(0), Accion = "SALIDA", }; ObjDetalle.Add(TypDetalle); } } if (VbTieneReg.Equals("S")) { CsInsertElementoAlmacen ClaseIEA = new CsInsertElementoAlmacen(); ClaseIEA.FormOrigen(ViewState["PFileName"].ToString()); ClaseIEA.Alimentar(ObjDetalle); string Mensj = ClaseIEA.GetMensj(); if (!Mensj.Equals("")) { string VbPNMen = ClaseIEA.GetPn().Trim().Equals("") ? "" : "[P/N: " + ClaseIEA.GetPn().Trim() + "]"; string VbSNMen = ClaseIEA.GetSn().Trim().Equals("") ? "" : "[S/N: " + ClaseIEA.GetSn().Trim() + "]"; string VbLot = ClaseIEA.GetLote().Trim().Equals("") ? "" : "[LT/N: " + ClaseIEA.GetLote().Trim() + "]"; Result = Idioma.Select("Objeto= '" + Mensj.ToString().Trim() + "'"); foreach (DataRow row in Result) { Mensj = row["Texto"].ToString().Trim(); } ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + Mensj + " " + VbPNMen + " " + VbSNMen + " " + VbLot + "');", true); return; } TxtObserv.Text = ""; DdlBodega.Text = ""; DdlCliente.Text = ""; BtnEntregar.Enabled = false; GrdDetalle.DataSource = null; GrdDetalle.DataBind(); } }
public void Carga_Datos() { DefinirColumnasNotebook(); GrdDetalle.DataSource = DatosDetalle.Tables[TDetalle]; GrdDetalle.DataBind(); }
protected void CargarDetalle(Int32 idInventario, Int32 idVenta) { // List<INE.ServiciosWeb.Producto.Contrato.Producto> productos; DataTable detalle; Int32 i; FormsIdentity id = (FormsIdentity)Context.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; string data = ticket.UserData; Utils.Usuario user = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <Utils.Usuario>(data); ProductoServicio_T.ProductoContratoClient pro = new ProductoContratoClient(); var productos = pro.ObtenerListadoPorAgenteEconomicoActivo(user.IdAgenteEconomico); detalle = new DataTable(); detalle.Columns.Add("Id"); detalle.Columns.Add("Concepto"); i = 2; foreach (var p in productos) { var productoPresentacionTipo = p.ProductoPresentacionTipos.Where(pp => pp.IdPresentacionTipo == 4 && pp.Activo == true).FirstOrDefault(); detalle.Columns.Add(productoPresentacionTipo.IdProductoxPresentacion.ToString()); GrdDetalle.Columns[i].HeaderText = p.NombreComercial; GrdComprobante.Columns[i].HeaderText = p.NombreComercial; //ESTO LO PUSE VEAMOS i++; } detalle.Rows.Add(detalle.NewRow()); detalle.Rows[detalle.Rows.Count - 1]["Concepto"] = "Inventario Actual(Gls): "; detalle.Rows[detalle.Rows.Count - 1]["Id"] = idInventario; detalle.Rows.Add(detalle.NewRow()); detalle.Rows[detalle.Rows.Count - 1]["Id"] = 2; detalle.Rows[detalle.Rows.Count - 1]["Concepto"] = "Ventas del día anterior(Lts):"; detalle.Rows.Add(detalle.NewRow()); detalle.Rows[detalle.Rows.Count - 1]["Id"] = 3; detalle.Rows[detalle.Rows.Count - 1]["Concepto"] = "Precio x Lts(C$):"; GrdDetalle.DataSource = detalle; GrdDetalle.DataBind(); GrdComprobante.DataSource = detalle; GrdComprobante.DataBind(); // GrdComprobante.Rows[0].Cells[1].BackColor = Color.FromArgb(109,108,110); //Con esto coloreamos la celdas de la parte izquierda del comprobante // ((TextBox)GrdDetalle.Rows[1].FindControl("Txt8") ).Text = "15" ; for (i = 0; i < productos.Count(); i++) { var productoPresentacion = productos[i].ProductoPresentacionTipos.Where(pp => pp.IdPresentacionTipo == 4 && pp.Activo == true).SingleOrDefault(); if (productoPresentacion != null) { if (idInventario != 0) { InventarioServicio_T.InventarioContratoClient invent = new InventarioContratoClient(); var inventario = invent.Obtener(idInventario); (GrdDetalle.Rows[0].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = inventario.InventarioDetalle.Where(det => det.IdProductoxPresentacion == productoPresentacion.IdProductoxPresentacion).SingleOrDefault().InventarioTotal.ToString("#,##0.00"); TxtObservacion.Text = inventario.Observaciones; //ASPxTimeEdit.Value = inventario.HoraCorte; } if (idVenta != 0) { VentaServicio_T.VentaContratoClient vent = new VentaContratoClient(); var venta = vent.Obtener(idVenta); (GrdDetalle.Rows[1].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = venta.VentaDetalles.Where(det => det.IdProductoxPresentacion == productoPresentacion.IdProductoxPresentacion).SingleOrDefault().Volumen.ToString("#,##0.00"); (GrdDetalle.Rows[2].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = venta.VentaDetalles.Where(det => det.IdProductoxPresentacion == productoPresentacion.IdProductoxPresentacion).SingleOrDefault().Precio.ToString("#,##0.00"); } (GrdDetalle.Rows[0].Cells[i + 2].FindControl("HdfIdProductoXPresentacion" + (i + 2).ToString()) as HiddenField).Value = productoPresentacion.IdProductoxPresentacion.ToString(); (GrdDetalle.Rows[1].Cells[i + 2].FindControl("HdfIdProductoXPresentacion" + (i + 2).ToString()) as HiddenField).Value = productoPresentacion.IdProductoxPresentacion.ToString(); (GrdDetalle.Rows[2].Cells[i + 2].FindControl("HdfIdProductoXPresentacion" + (i + 2).ToString()) as HiddenField).Value = productoPresentacion.IdProductoxPresentacion.ToString(); } else { (GrdDetalle.Rows[0].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = "0.00"; (GrdDetalle.Rows[1].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = "0.00"; (GrdDetalle.Rows[2].Cells[i + 2].FindControl("TxtCampo" + (i + 2).ToString()) as TextBox).Text = "0.00"; } (GrdDetalle.Rows[0].Cells[i + 2].FindControl("HdfIdProducto" + (i + 2).ToString()) as HiddenField).Value = productos[i].IdProducto.ToString(); (GrdDetalle.Rows[1].Cells[i + 2].FindControl("HdfIdProducto" + (i + 2).ToString()) as HiddenField).Value = productos[i].IdProducto.ToString(); (GrdDetalle.Rows[2].Cells[i + 2].FindControl("HdfIdProducto" + (i + 2).ToString()) as HiddenField).Value = productos[i].IdProducto.ToString(); } for (i = productos.Count() + 2; i < GrdDetalle.Columns.Count; i++) { GrdDetalle.Columns[i].Visible = false; GrdComprobante.Columns[i].Visible = false; } if (idVenta > 0) { VentaServicio_T.VentaContratoClient vent = new VentaContratoClient(); var venta = vent.Obtener(idVenta); } }
protected void BtnGetDetailsOT_Click(object sender, EventArgs e) { if (GrdOT.Rows.Count > 0) { _DETALLE = new List <DetalleConsumo>(); int cont = 0; bool StockBreak = false; List <string> CodeBrk = new List <string>(); List <string> OTCodeBrk = new List <string>(); foreach (GridViewRow row in GrdOT.Rows) { var check = row.FindControl("ChkOT") as CheckBox; if (check.Checked) { cont++; GetDatosOtPconsumno GetOt = new GetDatosOtPconsumno(check.Text); List <TablaPOTD> ListpOTD = new List <TablaPOTD>(); ListpOTD.AddRange(GetOt.POTD.Where(it => it._NIVEL == "1").Where(dot => dot._CANTIDADF > 0).ToList()); GetTotalStock totalStock = new GetTotalStock(GetOt.POTE._EMPRESA, "PHU", "PPR"); foreach (var item in ListpOTD) { bool GetAltern = false; bool hastock = false; if (totalStock.Stock.ContainsKey(item._CODIGO)) { double ValueStock = (double)totalStock.Stock[item._CODIGO]; if (ValueStock <= 0 || ValueStock < item._CANTIDADF) { GetAltern = true; } else { totalStock.Stock[item._CODIGO] = ValueStock - item._CANTIDADF; hastock = true; } } else { GetAltern = true; } string code; if (GetAltern) { VerStockMaterial verStock = new VerStockMaterial(GetOt.POTE._EMPRESA, "PHU", "PPR", item._CODIGO, item._CANTIDADF); if (verStock.HasStock) { code = item._CODIGO; hastock = true; } else if (verStock.IsAlternativa) { code = verStock.Datos.CODIGO; hastock = true; } else { hastock = false; code = ""; } } else { code = item._CODIGO; } if (hastock) { GetPMSUCyCODMAQ PMSUCyCODMAQ = new GetPMSUCyCODMAQ(code, "PHU", item._IDPOTL, item._OPERACION, GetOt.POTE._EMPRESA); DetalleConsumo detail = new DetalleConsumo { _IDPOTL = item._IDPOTL, _CANTIDADF = item._CANTIDADF, _CODIGO = code, _IDPOTD = item.IDPOTD, _KOFUCRE = GetOt.POTE._KOFUCRE, _MODO = GetOt.POTE._MODO, _NIVELSUP = item._NIVELSUP, _NUMOT = GetOt.POTE._NUMOT, _OPERACION = item._OPERACION, _SUBNREG = item._SUBNREG, _SUOT = GetOt.POTE._SUOT, _TIMODO = GetOt.POTE._TIMODO, _TIPO = item._TIPO, _TIPOUNI = item._TIPOUNI, _UNIDAD = item._UNIDAD, _UNIDADC = item._UNIDADC, _TAMODO = GetOt.POTE._TAMODO, _CODMAQ = PMSUCyCODMAQ.CODMAQ, _PPPRPMSUC = PMSUCyCODMAQ.PMSUC, }; _DETALLE.Add(detail); } else { StockBreak = true; CodeBrk.Add(item._CODIGO.Trim()); OTCodeBrk.Add(GetOt.POTE._NUMOT); code = ""; } } } } if (_DETALLE.Count > 0) { BtnGenConsumo.Visible = true; } else { BtnGenConsumo.Visible = false; } panelDetalle.Visible = true; GrdDetalle.DataSource = _DETALLE; GrdDetalle.DataBind(); if (StockBreak) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Los siguientes códigos no tienen stock ni producto alternativo: " + string.Join(", ", CodeBrk.Distinct()) + ". La(s) OT(s) " + string.Join(", ", OTCodeBrk.Distinct()) + " seguirá apareciendo hasta que se haga el consumo de dicho(s) componentes.')", true); } } else { } }