protected void DgNew_Page(Object sender, DataGridPageChangedEventArgs e) { this.dgNew.CurrentPageIndex = e.NewPageIndex; this.dgNew.DataSource = dtNew; this.dgNew.DataBind(); DatasToControls.JustificacionGrilla(dgNew, dtNuevos); }
protected void ActualizarListaPrecios(Object Sender, EventArgs e) { if (this.plFiltros.Visible && this.dtFiltrosValor.Rows.Count == 0) { Utils.MostrarAlerta(Response, "Por favor ingrese al menos un filtro"); } else { ListaPrecios listaActualizar = new ListaPrecios(Request.QueryString["codLista"]); bool status = true; DataTable dtOut = listaActualizar.ActualizacionValores(this.plFiltros.Visible, this.dtFiltrosValor, Request.QueryString["valBase"], Request.QueryString["tipOper"], Request.QueryString["valOper"], ref status); if (status) { dgResultado.DataSource = dtOut; dgResultado.DataBind(); DatasToControls.JustificacionGrilla(dgResultado, dtOut); plProceso.Visible = false; plResultado.Visible = true; } else { lb.Text += listaActualizar.ProcessMsg; } } }
protected void DgError_Page(Object sender, DataGridPageChangedEventArgs e) { this.dgError.CurrentPageIndex = e.NewPageIndex; this.dgError.DataSource = dtError; this.dgError.DataBind(); DatasToControls.JustificacionGrilla(dgError, dtError); }
protected void BindDgBackOrder() { dgBackOrder.DataSource = dtBackOrder; Session["dtBackOrder"] = dtBackOrder; dgBackOrder.DataBind(); DatasToControls.JustificacionGrilla(dgBackOrder, dtBackOrder); }
protected void DgUpdate_Page(Object sender, DataGridPageChangedEventArgs e) { this.dgUpdate.CurrentPageIndex = e.NewPageIndex; this.dgUpdate.DataSource = dtUpdate; this.dgUpdate.DataBind(); DatasToControls.JustificacionGrilla(dgUpdate, dtUpdate); }
protected void ingresardatos_cesantias(double valorpagado, string mes, int numero) { DataRow fila = DataTable1.NewRow(); fila["VALOR PAGADO"] = valorpagado; fila["MES"] = mes; DataTable1.Rows.Add(fila); DATAGRIDCESANTIAS.DataSource = DataTable1; DATAGRIDCESANTIAS.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DATAGRIDCESANTIAS); DatasToControls.JustificacionGrilla(DATAGRIDCESANTIAS, DataTable1); }
protected void ReConstruir_dgConciliacion() { if (Request.QueryString["col"] == "3") { this.Construir_dgConciliacion3(); } else if (Request.QueryString["col"] == "4") { this.Construir_dgConciliacion4(); } dgConciliacion.DataSource = dtConciliacion; dgConciliacion.DataBind(); DatasToControls.JustificacionGrilla(dgConciliacion, dtConciliacion); }
protected void ingresarDatos(string vinVehiculo, string color, string diasInv) { DataRow fila = vehis.NewRow(); fila["vinVehiculo"] = vinVehiculo; fila["color"] = color; fila["diasInv"] = diasInv; vehis.Rows.Add(fila); dgVehiculos.DataSource = vehis; dgVehiculos.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgVehiculos); DatasToControls.JustificacionGrilla(dgVehiculos, vehis); }
protected void ingresardatos_cesaanteriores(string fechaInicio, string fechaFinal, double Cesantias, double interesescesantia, double diastrabajados) { DataRow fila = DataTable2.NewRow(); fila["FECHA INICIO"] = fechaInicio; fila["FECHA FINAL"] = fechaFinal; fila["CESANTIAS"] = Cesantias; fila["INTERESES DE CESANTIA"] = interesescesantia; fila["DIAS TRABAJADOS"] = diastrabajados; DataTable2.Rows.Add(fila); DATAGRIDCESAANTERIORES.DataSource = DataTable2; DATAGRIDCESAANTERIORES.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DATAGRIDCESAANTERIORES); DatasToControls.JustificacionGrilla(DATAGRIDCESAANTERIORES, DataTable2); }
protected void Bind_dgCampos() { Session["dtCampos"] = dtCampos; dgCampos.DataSource = dtCampos; dgCampos.DataBind(); DatasToControls.JustificacionGrilla(dgCampos, dtCampos); if (dtCampos.Rows.Count > 0) { btnCnt.Visible = true; } else { btnCnt.Visible = false; } }
protected void BindDgSugerido(ArrayList mesesAnos) { if (dtSugerido.Rows.Count > 1) { for (int j = 11; j < 23; j++) { string[] mesAnoLabel = mesesAnos[j - 11].ToString().Split('-'); string mes = DBFunctions.SingleData("SELECT pmes_nombre FROM pmes WHERE pmes_mes=" + mesAnoLabel[0] + ""); dgSugerido.Columns[j].HeaderText = mes + "-" + mesAnoLabel[1]; } } dgSugerido.DataSource = dtSugerido; dgSugerido.DataBind(); DatasToControls.JustificacionGrilla(dgSugerido, dtSugerido); }
protected void ingresar_datos_Operaciones(string pubi_codigo, string mite_codigo, string mite_nombre, string palm_almacen, string msal_cantactual, string msal_costprom) { DataRow fila = tablaItems.NewRow(); fila["PUBI_CODIGO"] = pubi_codigo; fila["MITE_CODIGO"] = mite_codigo; fila["MITE_NOMBRE"] = mite_nombre; fila["PALM_ALMACEN"] = palm_almacen; fila["MSAL_CANTACTUAL"] = msal_cantactual; fila["MSAL_COSTPROM"] = msal_costprom; tablaItems.Rows.Add(fila); this.dgitems.DataSource = tablaItems; dgitems.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgitems); DatasToControls.JustificacionGrilla(dgitems, tablaItems); }
protected void ingresardatos_cesantias(string codigoempleado, double Cesantias, double interesescesantia, double diastrabajados, string nombres, string apellidos, double sueldopromedio) { DataRow fila = DataTable1.NewRow(); fila["CODIGO EMPLEADO"] = codigoempleado; fila["NOMBRE"] = nombres + " " + apellidos; // insertar celdas de cesantias retiradas y otra para intereses retirados fila["CESANTIAS"] = Cesantias; fila["INTERESES DE CESANTIA"] = interesescesantia; fila["DIAS TRABAJADOS"] = diastrabajados; fila["SUELDO PROMEDIO"] = sueldopromedio; DataTable1.Rows.Add(fila); DATAGRIDCESANTIAS.DataSource = DataTable1; DATAGRIDCESANTIAS.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DATAGRIDCESANTIAS); DatasToControls.JustificacionGrilla(DATAGRIDCESANTIAS, DataTable1); }
protected void MostrarPedido(Object Sender, EventArgs E) { Int16 ano = Convert.ToInt16(DBFunctions.SingleData("SELECT pano_ano from cinventario")); string query = "SELECT DBXSCHEMA.EDITARREFERENCIAS(DPI.mite_codigo,PLIN.plin_tipo) AS REFERENCIA, MIT.mite_nombre AS DESCRIPCION, DPI.dped_cantpedi AS \"CANTIDAD PEDIDA\", DPI.dped_cantasig AS \"CANTIDAD ASIGNADA\", DPI.dped_cantfact AS \"CANTIDAD FACTURADA\", DPI.dped_cantpedi - DPI.dped_cantasig - DPI.dped_cantfact AS \"CANTIDAD PENDIENTE\", DPI.dped_valounit AS \"VALOR UNITARIO\", DPI.dped_PORCDESC AS DESCTO, DPI.PIVA_PORCIVA AS IVA, MS.MSAL_CANTACTUAL - MS.MSAL_CANTASIG AS \"SALDO BODEGAS\" FROM dpedidoitem DPI, plineaitem PLIN, mitems MIT LEFT JOIN MSALDOITEM MS ON MS.MITE_CODIGO = MIT.MITE_CODIGO AND MS.PANO_ANO = " + ano + " "; DataSet ds = new DataSet(); if (ddlPedidos.SelectedValue.Split('-').Length == 4) { string[] infoPed = this.ddlPedidos.SelectedValue.Split('-'); query += " WHERE DPI.pped_codigo='" + infoPed[1] + "-" + infoPed[2] + "' AND DPI.mped_numepedi=" + infoPed[3] + " AND DPI.mite_codigo=MIT.mite_codigo AND DPI.mped_clasregi='" + actor + "' AND PLIN.plin_codigo=MIT.plin_codigo"; //Primero cargamos la informacion general del pedido this.plInfoPedido.Controls.Add(new LiteralControl("Nit : " + infoPed[0] + ""));//Nit this.plInfoPedido.Controls.Add(new LiteralControl("<br>Apellidos y Nombres : " + DBFunctions.SingleData("SELECT mnit_apellidos CONCAT ' ' CONCAT mnit_nombres FROM mnit WHERE mnit_nit='" + infoPed[0] + "'") + "")); this.plInfoPedido.Controls.Add(new LiteralControl("<br>Fecha del Pedido : " + Convert.ToDateTime(DBFunctions.SingleData("SELECT mped_pedido FROM mpedidoitem WHERE pped_codigo='" + infoPed[1] + "-" + infoPed[2] + "' AND mped_numepedi=" + infoPed[3] + " AND mnit_nit='" + infoPed[0] + "'")).ToShortDateString() + "")); this.plInfoPedido.Controls.Add(new LiteralControl("<br>Almacen : " + DBFunctions.SingleData("SELECT palm_descripcion FROM palmacen WHERE tvig_vigencia='V' and palm_almacen=(SELECT palm_almacen FROM mpedidoitem WHERE pped_codigo='" + infoPed[1] + "-" + infoPed[2] + "' AND mped_numepedi=" + infoPed[3] + " AND mnit_nit='" + infoPed[0] + "')") + "")); } else { string[] infoPed = this.ddlPedidos.SelectedValue.Split('-'); query += " WHERE DPI.pped_codigo='" + infoPed[1] + "' AND DPI.mped_numepedi=" + infoPed[2] + " AND DPI.mite_codigo=MIT.mite_codigo AND DPI.mped_clasregi='" + actor + "' AND PLIN.plin_codigo=MIT.plin_codigo"; //Primero cargamos la informacion general del pedido this.plInfoPedido.Controls.Add(new LiteralControl("Nit : " + infoPed[0] + ""));//Nit this.plInfoPedido.Controls.Add(new LiteralControl("<br>Apellidos y Nombres : " + DBFunctions.SingleData("SELECT mnit_apellidos CONCAT ' ' CONCAT mnit_nombres FROM mnit WHERE mnit_nit='" + infoPed[0] + "'") + "")); this.plInfoPedido.Controls.Add(new LiteralControl("<br>Fecha del Pedido : " + Convert.ToDateTime(DBFunctions.SingleData("SELECT mped_pedido FROM mpedidoitem WHERE pped_codigo='" + infoPed[1] + "' AND mped_numepedi=" + infoPed[2] + " AND mnit_nit='" + infoPed[0] + "'")).ToShortDateString() + "")); this.plInfoPedido.Controls.Add(new LiteralControl("<br>Almacen : " + DBFunctions.SingleData("SELECT palm_descripcion FROM palmacen WHERE tvig_vigencia='V' and palm_almacen=(SELECT palm_almacen FROM mpedidoitem WHERE pped_codigo='" + infoPed[1] + "' AND mped_numepedi=" + infoPed[2] + " AND mnit_nit='" + infoPed[0] + "')") + "")); } if (this.chkItemPendi.Checked) { this.plInfoPedido.Controls.Add(new LiteralControl("<br>SOLO ITEMS PENDIENTES")); DBFunctions.Request(ds, IncludeSchema.NO, query + " AND (DPI.dped_cantpedi - DPI.dped_cantasig - DPI.dped_cantfact)>0 AND DPI.dped_cantfact = 0"); } else { this.plInfoPedido.Controls.Add(new LiteralControl("<br>TODOS LOS ITEMS")); DBFunctions.Request(ds, IncludeSchema.NO, query); } this.dgPedido.DataSource = ds.Tables[0]; this.dgPedido.DataBind(); DatasToControls.JustificacionGrilla(this.dgPedido, ds.Tables[0]); }
protected void ingresar_datos_Operaciones(string codigo, string bodega, string estante, string cajon, string item) { DataRow fila = tablaItems.NewRow(); fila["CODIGO"] = codigo; fila["BODEGA"] = bodega; fila["ESTANTE"] = estante; fila["CAJON"] = cajon; fila["ITEM"] = item; tablaItems.Rows.Add(fila); dgitems.DataSource = tablaItems; dgitems.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgitems); DatasToControls.JustificacionGrilla(dgitems, tablaItems); }
protected void BindDatas() { Session["dtItemsRDir"] = dtItemsRDir; dgItemsRDir.DataSource = dtItemsRDir; dgItemsRDir.DataBind(); DatasToControls.JustificacionGrilla(dgItemsRDir, dtItemsRDir); if (dtItemsRDir.Rows.Count > 0) { btnReversar.Visible = true; tbNit.Enabled = tbNita.Enabled = ddlPreRecep.Enabled = btnSelecNIT.Enabled = btnCargar.Enabled = false; } else { btnReversar.Visible = false; tbNit.Enabled = tbNita.Enabled = ddlPreRecep.Enabled = btnSelecNIT.Enabled = btnCargar.Enabled = true; Utils.MostrarAlerta(Response, "Esta PreRecepción no tiene items para reversar"); } }
protected void ingresar_datos_llegada(string pcat_codigo, string pcat_descripcion, string pcol_codigo, string fechaColor, string fechaFabricacion, string fechaLlegada, string obs, string estado) { DataRow fila = tablaItems.NewRow(); fila["pcat_codigo"] = pcat_codigo; fila["pcat_descripcion"] = pcat_descripcion; fila["pcol_codigo"] = pcol_codigo; fila["fechaColor"] = fechasNulasDT(fechaColor); fila["fechaFabricacion"] = fechasNulasDT(fechaFabricacion); fila["fechaLlegada"] = fechasNulasDT(fechaLlegada); fila["Observacion"] = obs; fila["estado"] = estado; tablaItems.Rows.Add(fila); dgPedido.DataSource = tablaItems; dgPedido.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgPedido); DatasToControls.JustificacionGrilla(dgPedido, tablaItems); desabilitar(); }
protected void BindDatas() { //dgItems.EnableViewState = true; txtNumItem.Text = dtInserts.Rows.Count.ToString(); double total = 0, subtotal = 0, iva = 0, totalDescuento = 0, numeroUnidades = 0; double totalf = 0, subtotalf = 0, ivaf = 0, totalDescuentof = 0; double valorFletes = Convert.ToDouble(txtTotIF.Text.Substring(1)); double ivaFletes = Convert.ToDouble(tbIvaFlts.Text.Substring(1)); int n; if (dtInserts.Rows.Count > 0) { for (n = 0; n < dtInserts.Rows.Count; n++) { subtotal += (Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])); subtotalf = (Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])); totalDescuento += Math.Round(((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) * (Convert.ToDouble(dtInserts.Rows[n][5]) / 100)), numDecimales); totalDescuentof = ((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) * (Convert.ToDouble(dtInserts.Rows[n][5]) / 100)); iva += Math.Round((((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) - ((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) * (Convert.ToDouble(dtInserts.Rows[n][5]) / 100))) * (Convert.ToDouble(dtInserts.Rows[n][4]) / 100)), numDecimales); ivaf = (((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) - ((Convert.ToDouble(dtInserts.Rows[n][2]) * Convert.ToDouble(dtInserts.Rows[n][3])) * (Convert.ToDouble(dtInserts.Rows[n][5]) / 100))) * (Convert.ToDouble(dtInserts.Rows[n][4]) / 100)); totalDescuentof = Math.Round(totalDescuentof * 1, numDecimales); ivaf = Math.Round(ivaf * 1, numDecimales); totalf = subtotalf - totalDescuentof + ivaf; dtInserts.Rows[n][6] = totalf; numeroUnidades += Convert.ToDouble(dtInserts.Rows[n][2]); } } totalDescuento = Math.Round(totalDescuento * 1, numDecimales); iva = Math.Round(iva * 1, numDecimales); total = subtotal - totalDescuento + iva;//Convert.ToDouble(dtInserts.Rows[n][6]); txtSubTotal.Text = subtotal.ToString("C"); txtDesc.Text = totalDescuento.ToString("C"); txtIVA.Text = iva.ToString("C"); txtTotal.Text = total.ToString("C"); txtNumItem.Text = dtInserts.Rows.Count.ToString("N"); txtNumUnid.Text = numeroUnidades.ToString("N"); txtGTot.Text = (total + valorFletes + ivaFletes).ToString("C"); dvInserts = new DataView(dtInserts); dgItems.DataSource = dtInserts; dgItems.DataBind(); DatasToControls.JustificacionGrilla(dgItems, dtInserts); }
protected void ingresardatos_prima(string codigoempleado, double Cesantias, double diastrabajados, string nombres, string apellidos, double sueldopromedio, double sueldo, double descuentos) { DataRow fila = DataTable1.NewRow(); fila["CODIGO EMPLEADO"] = codigoempleado; fila["NOMBRE"] = nombres + " " + apellidos; double tem = Math.Round(Cesantias, 0); fila["VALOR PRIMA"] = tem; fila["DIAS TRABAJADOS"] = diastrabajados; fila["SUELDO PROMEDIO"] = sueldopromedio; fila["SUELDO ACTUAL"] = sueldo; fila["DESCUENTOS"] = descuentos; DataTable1.Rows.Add(fila); DATAGRIDPRIMA.DataSource = DataTable1; DATAGRIDPRIMA.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DATAGRIDPRIMA); DatasToControls.JustificacionGrilla(DATAGRIDPRIMA, DataTable1); }
protected void ingresar_datos_proceso(string fechainicio, string fechafinal, string secuencia) { DataRow fila = DataTable1.NewRow(); DateTime fechainic = new DateTime(); DateTime fechafin = new DateTime(); fechainic = Convert.ToDateTime(fechainicio); fechafin = Convert.ToDateTime(fechafinal); fila["FECHA INICIO"] = fechainic.ToString("yyyy-MM-dd"); fila["FECHA FINAL"] = fechafin.ToString("yyyy-MM-dd"); fila["SECUENCIA"] = secuencia; DataTable1.Rows.Add(fila); DataGrid1.DataSource = DataTable1; DataGrid1.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DataGrid1); DatasToControls.JustificacionGrilla(DataGrid1, DataTable1); for (int i = 0; i < DataTable1.Rows.Count; i++) { ((Button)DataGrid1.Items[i].Cells[3].Controls[1]).Enabled = true; } }
protected void BindDatas() { int n, m; dgItems.EnableViewState = true; dvInserts = new DataView(dtInserts); dgItems.DataSource = dtInserts; dgItems.DataBind(); for (n = 0; n < dgItems.Items.Count; n++) { for (m = 3; m <= 5; m++) { dgItems.Items[n].Cells[m].HorizontalAlign = HorizontalAlign.Right; } } DatasToControls.JustificacionGrilla(dgItems, dtInserts); double t = 0; int ni = 0; if (dtInserts.Rows.Count > 0) { for (n = 0; n < dtInserts.Rows.Count; n++) { t += Convert.ToDouble(dtInserts.Rows[n][5]); //total costos ni += Convert.ToInt32(dtInserts.Rows[n][2]); //total de cantidad asignada } } txtTotal.Text = t.ToString("C"); txtNumItem.Text = dtInserts.Rows.Count.ToString(); txtNumUnid.Text = ni.ToString(); if (dtInserts.Rows.Count == 0) { dgItems.EditItemIndex = -1; ddlAlmacen.Enabled = ddlCentro.Enabled = ddlVendedor.Enabled = ddlCodDoc.Enabled = tbDate.Enabled = tbPrefDocRef.Enabled = tbPrefNumRef.Enabled = true; } else { ddlAlmacen.Enabled = ddlCentro.Enabled = ddlVendedor.Enabled = ddlCodDoc.Enabled = tbDate.Enabled = tbPrefDocRef.Enabled = tbPrefNumRef.Enabled = false; } }
protected void ingresar_datos_Operaciones( string numero, string pubi_nombre, string mite_codigoEditado, string mite_nombre, string palm_almacen, string msal_cantactual, string msal_costprom, string mite_codigo, string pubi_codigo) { DataRow fila = tablaItems.NewRow(); fila["NUMERO"] = numero; fila["PUBI_NOMBRE"] = pubi_nombre; fila["MITE_CODIGOEDITADO"] = mite_codigoEditado; fila["MITE_NOMBRE"] = mite_nombre; fila["PALM_ALMACEN"] = palm_almacen; fila["MSAL_CANTACTUAL"] = msal_cantactual; fila["MSAL_COSTPROM"] = msal_costprom; fila["MITE_CODIGO"] = mite_codigo; fila["PUBI_CODIGO"] = pubi_codigo; double cantidad = 0; try { cantidad = Convert.ToDouble(msal_cantactual); } catch { } tablaItems.Rows.Add(fila); dgitems.DataSource = tablaItems; dgitems.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgitems); DatasToControls.JustificacionGrilla(dgitems, tablaItems); }
protected void ingresardatos_activarquincena(int codigoquincena, int ano, int mes, int periodonomina, int estado) { DataRow fila = DataTable1.NewRow(); fila["CODIGO QUINCENA"] = codigoquincena; fila["AÑO"] = ano; fila["MES"] = mes; fila["PERIODO NOMINA"] = periodonomina; fila["ESTADO"] = estado; DataTable1.Rows.Add(fila); DATAGRIDACTIVARQ.DataSource = DataTable1; DATAGRIDACTIVARQ.DataBind(); DatasToControls.Aplicar_Formato_Grilla(DATAGRIDACTIVARQ); DatasToControls.JustificacionGrilla(DATAGRIDACTIVARQ, DataTable1); for (int i = 0; i < DataTable1.Rows.Count; i++) { if (Convert.ToDouble(DataTable1.Rows[i][4]) == 2) { ((Button)DATAGRIDACTIVARQ.Items[i].Cells[5].Controls[1]).Enabled = true; } } }
protected void Operaciones(string codigo) { DataSet Operacion = new DataSet(); string sqlOpers = String.Format( @"SELECT dorden.ptem_operacion, ptem.ptem_descripcion, dorden.test_estado, morden.pdoc_codigo, morden.mord_numeorde, mcat.mcat_placa CONCAT ' - ' CONCAT pcat.pcat_descripcion, dob.DOBSOT_OBSERVACIONES, dorden.DORD_FECHCUMP FROM DORDENOPERACION dorden INNER JOIN ptempario ptem ON (dorden.ptem_operacion = ptem.ptem_operacion) INNER JOIN morden morden ON (morden.pdoc_codigo = dorden.pdoc_codigo AND morden.mord_numeorde = dorden.mord_numeorde AND morden.test_estado <> 'F') INNER JOIN Mcatalogovehiculo Mcat ON (morden.Mcat_VIN = MCAT.Mcat_VIN) INNER JOIN pcatalogovehiculo pcat ON (pcat.pcat_codigo = Mcat.pcat_codigo) LEFT JOIN dobservacionesot dob ON (dob.pdoc_codigo = dorden.pdoc_codigo AND dob.mord_numeorde = dorden.mord_numeorde AND dob.ptem_operacion = dorden.ptem_operacion) WHERE dorden.pven_codigo = '{0}' and dorden.test_estado <> 'X' and dorden.test_estado <> 'C' ORDER BY mcat.mcat_placa" , codigo); DBFunctions.Request(Operacion, IncludeSchema.NO, sqlOpers); if (Operacion.Tables[0].Rows.Count > 0) { this.Preparar_Tabla_Operaciones(); ddlMecanicos.Enabled = false; for (int i = 0; i < Operacion.Tables[0].Rows.Count; i++) { this.ingresar_datos_Operaciones( Operacion.Tables[0].Rows[i][0].ToString(), // código Operacion.Tables[0].Rows[i][1].ToString(), // operación Operacion.Tables[0].Rows[i][2].ToString(), // Estado Operacion.Tables[0].Rows[i][3].ToString(), // Pref OT Operacion.Tables[0].Rows[i][4].ToString(), // Num OT Operacion.Tables[0].Rows[i][5].ToString(), // Placa Operacion.Tables[0].Rows[i][6].ToString(), // Observaciones Operacion.Tables[0].Rows[i][7].ToString()); // Fecha } this.dgOperaciones.DataSource = tablaOperaciones; dgOperaciones.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgOperaciones); DatasToControls.JustificacionGrilla(dgOperaciones, tablaOperaciones); btnActualizar.Visible = true; btnValidarPass.Visible = false; dgOperaciones.Visible = true; } else { Utils.MostrarAlerta(Response, "El técnico seleccionado, No tiene Operaciones"); ddlMecanicos.Enabled = true; btnActualizar.Visible = false; btnValidarPass.Visible = true; dgOperaciones.Visible = false; dgOperaciones.DataSource = null; dgOperaciones.DataBind(); } }
protected void aceptar_Click(object Sender, EventArgs e) { //fecha del documento para su posterior validación string fecha = Convert.ToDateTime(DBFunctions.SingleData("SELECT MTES_FECHA FROM DBXSCHEMA.MTESORERIA WHERE PDOC_CODIGO = '" + this.tipoDocAnular.SelectedValue + "' AND MTES_NUMERO = " + this.numeroDocumento.SelectedValue + ";")).GetDateTimeFormats()[5]; if (!Tools.General.validarCierreFinanzas(fecha, "T")) { Utils.MostrarAlerta(Response, "La fecha del documento no corresponde a la vigencia del sistema de Tesorería. Por favor revise."); return; } int i; bool sinregistros = false; DataSet ds; if (numeroDocumento.Items.Count == 0) { Utils.MostrarAlerta(Response, "No existen documentos"); } else { Session.Clear(); gridDatos.DataBind(); Control padre = (this.Parent).Parent; //Dependiendo del tipo de operación, son los datos que debo cargar //CONSIGNACIONES if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "CS") { if (DBFunctions.RecordExist("SELECT dtes_valor FROM dtesoreriaefectivo WHERE mtes_codigo='" + this.tipoDocAnular.SelectedValue + "' AND mtes_numero=" + this.numeroDocumento.SelectedValue + "")) { lbEfectivo.Text = "Total Consignación Efectivo : " + Convert.ToDouble(DBFunctions.SingleData("SELECT dtes_valor FROM dtesoreriaefectivo WHERE mtes_codigo='" + this.tipoDocAnular.SelectedValue + "' AND mtes_numero=" + this.numeroDocumento.SelectedValue + "")).ToString("C"); } else { lbEfectivo.Text = "Total Consignación Efectivo : " + Convert.ToDouble("0").ToString("C"); } ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT MCAJ_CODIGO AS \"PREFIJO RECIBO CAJA\", MCAJ_NUMERO AS \"NUMERO RECIBO CAJA\", TTIP_CODIGO AS \"TIPO DE DOCUMENTO\",DTES_NUMERODOC \"NUMERO DOCUMENTO\", PBAN_BANCO AS BANCO, DTES_VALOR AS VALOR,MTES_CODIGO AS \"PREFIJO CONSIGNACION\", MTES_NUMERO AS \"NUMERO CONSIGNACION\", PCUE_CODIGO AS CUENTA,MNIT_NIT AS NIT FROM DTESORERIADOCUMENTOS WHERE MTES_CODIGO='" + tipoDocAnular.SelectedValue + "' AND MTES_NUMERO=" + numeroDocumento.SelectedValue + ""); if (ds.Tables[0].Rows.Count != 0) { if (SePuedeAnularConsignacion(tipoDocAnular.SelectedValue, numeroDocumento.SelectedValue)) { lbInfo.Text = "Datos Consignación :"; Cargar_Tabla_Consignacion(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "CS"; } else { Utils.MostrarAlerta(Response, "Imposible anular la consignación, se ha producido alguno de los siguientes errores : \\n1. El estado de alguno de los documentos relacionados es Devuelto \\n2. Estos documentos ya se hicieron efectivos. \\nRevise por favor"); return; } } else { lbInfo.Text = "Datos Consignación :"; tablaDatos = new DataTable(); tablaDatos = ds.Tables[0]; Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "CS"; } } //DEVOLUCIONES else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "DE") { //Si es una devolucion ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT M.pcue_codigo AS CUENTA,M.mtes_fecha AS FECHA,D.mfac_codigo AS \"PREFIJO FACTURA\",D.mfac_numero AS \"NUMERO FACTURA\",D.mtes_codcons AS \"PREFIJO CONSIGNACION\",D.mtes_numcons AS \"NUMERO CONSIGNACION\",E.mcaj_codigo AS \"PREFIJO RECIBO CAJA\",E.mcaj_numero AS \"NUMERO RECIBO CAJA\",E.dtes_numerodoc AS \"NUMERO DOCUMENTO\",E.dtes_valor AS VALOR,P.pban_codigo AS BANCO FROM mtesoreria M,dtesoreriadevoluciones D,dtesoreriadocumentos E,mcaja J,mcajapago P WHERE M.pdoc_codigo=D.mtes_codigo AND M.mtes_numero=D.mtes_numero AND D.mtes_codcons=E.mtes_codigo AND D.mtes_numcons=E.mtes_numero AND D.dtes_consecutivo=E.dtes_consecutivo AND E.mcaj_codigo=J.pdoc_codigo AND E.mcaj_numero=J.mcaj_numero AND J.pdoc_codigo=P.pdoc_codigo AND J.mcaj_numero=P.mcaj_numero AND M.pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "' AND M.mtes_numero=" + this.numeroDocumento.SelectedValue + " AND P.test_estado='D'"); if (ds.Tables[0].Rows.Count != 0) { lbInfo.Text = "Datos Devolución :"; lbEfectivo.Text = ""; Cargar_Tabla_Devoluciones(); if (SePuedeAnularDevolucion(tipoDocAnular.SelectedValue, numeroDocumento.SelectedValue)) { for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; dgDev.DataSource = tablaDatos; dgDev.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgDev); dgDev.Visible = true; hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldoencanje*-1 FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "DE"; } else { Utils.MostrarAlerta(Response, "Imposible anular la devolución. Alguno de los cheques devueltos fue reconsignado"); return; } } else { lbInfo.Text = "NO HAY Documentos para Anular"; sinregistros = true; } } //REMISIONES A FINANCIERAS else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "RF") { ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT MCAJ_CODIGO AS \"PREFIJO RECIBO CAJA\", MCAJ_NUMERO AS \"NUMERO RECIBO CAJA\", MCAJ_CONS AS \"ID PAGO\", MNIT_NITFINANCIERA AS \"NIT FINANCIERA\", DTES_VALOR AS \"VALOR\", DTES_NUMDOC AS \"NUMERO CHEQUE\", MFAC_CODIGO AS \"PREFIJO FACTURA\", MFAC_NUMERO AS \"NUMERO FACTURA\" FROM DBXSCHEMA.DTESORERIAREMISION WHERE MTES_CODIGO='" + tipoDocAnular.SelectedValue + "' AND MTES_NUMERO=" + numeroDocumento.SelectedValue + ""); if (ds.Tables[0].Rows.Count != 0) { lbInfo.Text = "Datos Remisión :"; lbEfectivo.Text = ""; Cargar_Tabla_Remisiones(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); DatasToControls.JustificacionGrilla(gridDatos, tablaDatos); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "RF"; lbTitulo.Text = "Prefijo Nota Devolución : "; lbTitulo.Visible = true; ddlPrefDev.Visible = true; } else { lbInfo.Text = "NO HAY Documentos para Anular"; sinregistros = true; } } //DEVOLUCIONES DE CHEQUES DE FINANCIERAS else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "DF") { ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT DTD.mtes_codigoremision AS \"PREFIJO REMISION\",DTD.mtes_numeroremision AS \"NUMERO REMISION\",DTD.dtes_numerocheque AS \"NUMERO CHEQUE\",DTD.dtes_valorcheque AS \"VALOR\",DTD.mfac_codigo AS \"PREFIJO FACTURA CLIENTE\",DTD.mfac_numero AS \"NUMERO FACTURA CLIENTE\",DTR.mcaj_codigo AS \"PREFIJO RECIBO CAJA\",DTR.mcaj_numero AS \"NUMERO RECIBO CAJA\",DTD.MFAC_CODIORDEPAGO AS \"PREFIJO DEVOLUCION FINANCIERA\",DTD.mfac_numeordepago AS \"NUMERO DEVOLUCION FINANCIERA\" FROM dbxschema.dtesoreriadevolucionremision DTD,dbxschema.dtesoreriaremision DTR WHERE DTD.mtes_codigoremision=DTR.mtes_codigo AND DTD.mtes_numeroremision=DTR.mtes_numero AND DTD.dtes_numerocheque=DTR.dtes_numdoc AND DTD.mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND DTD.mtes_numero=" + numeroDocumento.SelectedValue + ""); if (ds.Tables[0].Rows.Count != 0) { if (SePuedeAnularDevolucionRemision(ds.Tables[0])) { lbInfo.Text = "Datos Devolución Remisión : "; lbEfectivo.Text = ""; Cargar_Tabla_DevRemisiones(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; dgDevRem.DataSource = tablaDatos; dgDevRem.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgDevRem); dgDevRem.Visible = true; lbTitulo.Text = "Prefijo Nota Devolución : "; lbTitulo.Visible = true; ddlPrefDevProv.Visible = true; hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo*-1 FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "DF"; } else { Utils.MostrarAlerta(Response, "Imposible anular la devolución. Alguno de los cheques devueltos fue reconsignado"); return; } } else { lbInfo.Text = "NO HAY Documentos para Anular"; sinregistros = true; } } //TRASLADOS ENTRE CUENTAS else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "TC") { ds = new DataSet(); //Si es un traslado con carta if (DBFunctions.RecordExist("SELECT * FROM dtesoreriatraslados WHERE mtes_codigo='" + this.tipoDocAnular.SelectedValue + "' AND mtes_numero=" + this.numeroDocumento.SelectedValue + "")) { DBFunctions.Request(ds, IncludeSchema.NO, "SELECT M.mtes_fecha AS FECHA,D.pcue_codigoori AS CUENTAORI,D.pcue_codigodes AS CUENTADES FROM mtesoreria M,dtesoreriatraslados D WHERE M.pdoc_codigo=D.mtes_codigo AND M.mtes_numero=D.mtes_numero AND M.pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "' AND M.mtes_numero=" + this.numeroDocumento.SelectedValue + ""); lbInfo.Text = "Información del Traslado"; lbEfectivo.Text = "Total Traslado :" + Convert.ToDouble(DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + this.tipoDocAnular.SelectedValue + "' AND mtes_numero=" + this.numeroDocumento.SelectedValue + " AND mtes_saldo>0")).ToString("C"); Cargar_Tabla_Traslados(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "TC"; } //Si es un traslado con cheque else { DBFunctions.Request(ds, IncludeSchema.NO, "SELECT M.mtes_fecha AS FECHA,H.pcue_codigoori AS CUEORI,H.pcue_codigodes AS CUEDES,H.mcaj_codigo AS CODIGOCAJA,H.mcaj_numero AS NUMEROCAJA,T.ttip_nombre AS TIPODOC,H.dtes_numerodoc AS NUMERODOC FROM mtesoreria M,dtesoreriatrasladoscheque H,ttipopago T WHERE M.pdoc_codigo=H.mtes_codigo AND M.mtes_numero=H.mtes_numero AND T.ttip_codigo=H.ttip_tipopago AND M.pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "' AND M.mtes_numero=" + this.numeroDocumento.SelectedValue + ""); lbInfo.Text = "Información del Traslado"; lbEfectivo.Text = "Total Traslado :" + Convert.ToDouble(DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + this.tipoDocAnular.SelectedValue + "' AND mtes_numero=" + this.numeroDocumento.SelectedValue + " AND mtes_saldo>0")).ToString("C"); Cargar_Tabla_TrasladosCh(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "TC"; } } //NOTAS BANCARIAS DEBITO else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "ND") { ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT mcue_codipuc AS CUENTA,dtes_valor AS VALOR FROM dbxschema.dtesorerianota WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); Cargar_Tabla_Notas(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "ND"; } //NOTAS BANCARIAS CREDITO else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "NR") { ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT mcue_codipuc AS CUENTA,dtes_valor AS VALOR FROM dbxschema.dtesorerianota WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); Cargar_Tabla_Notas(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); DatasToControls.JustificacionGrilla(gridDatos, tablaDatos); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "NR"; } //SI ES UNA ENTREGA DE CHEQUES else if (DBFunctions.SingleData("SELECT tdoc_tipodocu FROM pdocumento WHERE pdoc_codigo='" + this.tipoDocAnular.SelectedValue + "'") == "EC") { ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "SELECT DTES.mcaj_codigo AS \"PREFIJO COMPROBANTE DE EGRESO\",DTES.mcaj_numero AS \"NUMERO COMPROBANTE DE EGRESO\",DTES.dtes_nitben AS \"NIT DEL BENEFICIARIO\",DTES.dtes_numerodoc AS \"NUMERO DEL DOCUMENTO\",MCAJ.PBAN_CODIGO AS BANCO,MCAJ.MCPAG_VALOR AS VALOR FROM DBXSCHEMA.DTESORERIAENTREGAS DTES,DBXSCHEMA.MCAJAPAGO MCAJ WHERE MCAJ.PDOC_CODIGO=DTES.MCAJ_CODIGO AND MCAJ.MCAJ_NUMERO=DTES.MCAJ_NUMERO AND MCAJ.MCPAG_NUMERODOC=CAST(DTES.DTES_NUMERODOC AS CHAR(15)) AND DTES.MTES_CODIGO='" + tipoDocAnular.SelectedValue + "' AND DTES.MTES_NUMERO=" + numeroDocumento.SelectedValue + ""); if (ds.Tables[0].Rows.Count != 0) { lbInfo.Text = "Datos de la Entrega de Cheques"; Cargar_Tabla_Entregas(); for (i = 0; i < ds.Tables[0].Rows.Count; i++) { tablaDatos.ImportRow(ds.Tables[0].Rows[i]); } Session["tablaDatos"] = tablaDatos; gridDatos.DataSource = tablaDatos; gridDatos.DataBind(); hdnTotal.Value = DBFunctions.SingleData("SELECT mtes_saldo FROM mtesoreriasaldos WHERE mtes_codigo='" + tipoDocAnular.SelectedValue + "' AND mtes_numero=" + numeroDocumento.SelectedValue + ""); hdnTip.Value = "EC"; } else { lbInfo.Text = "NO HAY Documentos para Anular"; sinregistros = true; } } aceptar.Enabled = false; tipoDocAnular.Enabled = false; numeroDocumento.Enabled = false; ((Label)padre.FindControl("lbDetalle")).Text = "Detalle Anulación :"; ((TextBox)padre.FindControl("detalleTransaccion")).Visible = true; ((TextBox)padre.FindControl("valorConsignado")).Visible = false; ((TextBox)padre.FindControl("totalEfectivo")).Visible = false; ((Panel)padre.FindControl("panelValores")).Visible = true; if (sinregistros == false) { ((Button)padre.FindControl("guardar")).Enabled = true; } } }
protected void BindDgSugerido() { dgSugerido.DataSource = dtSugerido; dgSugerido.DataBind(); DatasToControls.JustificacionGrilla(dgSugerido, dtSugerido); }
protected void Llenar_ds(DataSet ds) { DataRow fila; if (ds.Tables[0].Columns.Count == 3) { if (Session["dtConciliacion"] == null) { this.Cargar_dtConciliacion3(); } this.Construir_dgConciliacion3(); try { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { fila = dtConciliacion.NewRow(); fila[0] = Convert.ToDateTime(ds.Tables[0].Rows[i][0]).ToString("yyyy-MM-dd"); fila[1] = ds.Tables[0].Rows[i][1].ToString(); fila[2] = Convert.ToDouble(ds.Tables[0].Rows[i][2]); fila[3] = false; fila[4] = -1; dtConciliacion.Rows.Add(fila); dgConciliacion.DataSource = dtConciliacion; dgConciliacion.DataBind(); DatasToControls.JustificacionGrilla(dgConciliacion, dtConciliacion); Session["dtConciliacion"] = dtConciliacion; } } catch { } } else if (ds.Tables[0].Columns.Count == 4) { if (Session["dtConciliacion"] == null) { this.Cargar_dtConciliacion4(); } this.Construir_dgConciliacion4(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { fila = dtConciliacion.NewRow(); fila[0] = Convert.ToDateTime(ds.Tables[0].Rows[i][0]).ToString("yyyy-MM-dd"); fila[1] = ds.Tables[0].Rows[i][1].ToString(); if (ds.Tables[0].Rows[i][2].ToString() == "") { fila[2] = 0; } else if (ds.Tables[0].Rows[i][2].ToString() != "") { fila[2] = Convert.ToDouble(ds.Tables[0].Rows[i][2]); } if (ds.Tables[0].Rows[i][3].ToString() == "") { fila[3] = 0; } else if (ds.Tables[0].Rows[i][3].ToString() != "") { fila[3] = Convert.ToDouble(ds.Tables[0].Rows[i][3]); } fila[4] = false; fila[5] = -1; dtConciliacion.Rows.Add(fila); dgConciliacion.DataSource = dtConciliacion; dgConciliacion.DataBind(); DatasToControls.JustificacionGrilla(dgConciliacion, dtConciliacion); Session["dtConciliacion"] = dtConciliacion; //lb.Text+=ds.Tables[0].Rows[i][3]+"<br><br>"; } } }
public void Cargar(object sender, System.EventArgs e) { plDownload.Controls.Clear(); string preP = "", numP = ""; string sa = ddlPeds.SelectedValue.ToString(); preP = sa.Substring(0, sa.LastIndexOf("-")).Trim(); numP = sa.ToString().Substring(sa.LastIndexOf("-") + 1).Trim(); ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "select t1.MPED_CLASREGI as ped_tipo, t1.PPED_CODIGO as ped_ref, t1.MPED_NUMEPEDI as ped_num, DBXSCHEMA.EDITARREFERENCIAS(t1.mite_codigo,t4.plin_tipo) as mite_codigo, t2.mite_nombre as mite_nombre, t1.dped_cantpedi as mite_cant, t3.msal_costprom as mite_precio, t1.piva_porciva as mite_piva, (t1.dped_cantpedi*t3.msal_costprom) + (t1.piva_porciva*(t1.dped_cantpedi*t3.msal_costprom))/100 as mite_total from dpedidoitem as t1, mitems as t2, msaldoitem as t3, plineaitem as t4 where t1.mite_codigo=t2.mite_codigo and t3.mite_codigo=t2.mite_codigo and t1.pped_codigo='" + preP + "' and t1.mped_numepedi=" + numP + " and t3.pano_ano=" + DBFunctions.SingleData("SELECT pano_ano from cinventario") + " and t2.plin_codigo=t4.plin_codigo"); // 0 1 2 3 4 5 6 7 8 int n; if (ds.Tables[0].Rows.Count <= 0) { Utils.MostrarAlerta(Response, "No hay items en el pedido!"); return; } double st = 0, t = 0, iva = 0, at, ia; for (n = 0; n < ds.Tables[0].Rows.Count; n++) { at = Convert.ToDouble(ds.Tables[0].Rows[n][5]) * Convert.ToDouble(ds.Tables[0].Rows[n][6]); st += at; ia = (Convert.ToDouble(ds.Tables[0].Rows[n][7]) / 100) * at; iva += ia; t += at + ia; ds.Tables[0].Rows[n][0] = (n + 1).ToString(); } DataRow nr = ds.Tables[0].NewRow(); nr[0] = "Subtotal:"; nr[8] = st; ds.Tables[0].Rows.Add(nr); nr = ds.Tables[0].NewRow(); nr[0] = "IVA:"; nr[8] = iva; ds.Tables[0].Rows.Add(nr); nr = ds.Tables[0].NewRow(); nr[0] = "Total:"; nr[8] = t; ds.Tables[0].Rows.Add(nr); dgItems.Visible = true; dgItems.DataSource = ds.Tables[0]; dgItems.DataBind(); DatasToControls.JustificacionGrilla(dgItems, ds.Tables[0]); btnGuarda.Visible = toolsHolder.Visible = btnReiniciar.Visible = true; ddlNIT.Enabled = ddlPeds.Enabled = btnCarga.Enabled = false; string [] pr = new string[2]; tabPreHeader = new Table(); tabFirmas = new Table(); pr[0] = "Nit: " + ddlNIT.SelectedItem.Text; pr[1] = DBFunctions.SingleData("SELECT t1.MNIT_DIRECCION concat ' - ' concat t2.pciu_nombre concat ' - ' concat t1.mnit_telefono FROM MNIT as t1, pciudad as t2 where t2.PCIU_CODIGO=t1.PCIU_CODIGO and MNIT_NIT='" + ddlNIT.SelectedValue + "'"); Press frontEnd = new Press(new DataSet(), reportTitle); frontEnd.PreHeader(tabPreHeader, dgItems.Width, pr); frontEnd.Firmas(tabFirmas, dgItems.Width); StringBuilder SB = new StringBuilder(); StringWriter SW = new StringWriter(SB); HtmlTextWriter htmlTW = new HtmlTextWriter(SW); tabPreHeader.RenderControl(htmlTW); dgItems.RenderControl(htmlTW); tabFirmas.RenderControl(htmlTW); string strRep; strRep = SB.ToString(); Session.Clear(); Session["Rep"] = strRep; }
protected void MostrarRetoma(DataTable dtRetomas) { dgRetoma.DataSource = dtRetomas; dgRetoma.DataBind(); DatasToControls.JustificacionGrilla(dgRetoma, dtRetomas); }
protected void MostrarAnticipos(DataTable dtAnticipos) { dgAnticipos.DataSource = dtAnticipos; dgAnticipos.DataBind(); DatasToControls.JustificacionGrilla(dgAnticipos, dtAnticipos); }