protected void Page_Load(object sender, System.EventArgs e) { DataSet VerKit = new DataSet(); if (!IsPostBack) { if (Request.QueryString["cod"] != null) { Panel1.Visible = false; Panel2.Visible = false; DBFunctions.Request(VerKit, IncludeSchema.NO, "Select ptem_operacion,ptem_descripcion from MKITOPERACION mk inner join ptempario pt on pt.ptem_operacion = mk.mkit_operacion where mkit_codikitoper='" + Request.QueryString["cod"] + "' ; Select DBXSCHEMA.EDITARREFERENCIAS(MI.MITE_CODIGO,PLI.PLIN_TIPO) as Codigo, mi.mite_nombre as Item from MKITITEM mk inner join MITEMS mi ON mi.mite_codigo = mk.mkit_coditem inner join PLINEAITEM PLI on MI.PLIN_CODIGO=PLI.PLIN_CODIGO WHERE mk.mkit_codikit = '" + Request.QueryString["cod"] + "'"); dgOperaciones.DataSource = VerKit.Tables[0]; dgItems.DataSource = VerKit.Tables[1]; DatasToControls.Aplicar_Formato_Grilla(dgOperaciones); DatasToControls.Aplicar_Formato_Grilla(dgItems); dgOperaciones.DataBind(); dgItems.DataBind(); if (DBFunctions.RecordExist("Select mkit_codikitoper from DBXSCHEMA.MKITOPERACION where mkit_codikitoper = '" + Request.QueryString["cod"] + "'")) { Panel1.Visible = true; } if (DBFunctions.RecordExist("Select mkit_codikit from DBXSCHEMA.MKITITEM where mkit_codikit = '" + Request.QueryString["cod"] + "'")) { Panel2.Visible = true; } } } }
protected bool LLenar_Grilla_Historial_Citas(DataGrid grilla, DateTime fechaMomento, Label labelHistorial) { int i; bool retorno = false; citasAnteriores = new DataSet(); this.Preparar_Grilla_Consulta_Citas(); //DBFunctions.Request(citasAnteriores,IncludeSchema.NO,"SELECT mcit_fecha, mcit_hora, mcit_codven, pkit_codigo, testcit_estacita FROM mcitataller WHERE mcit_fecha<'"+fechaMomento.Date.ToString("yyyy-MM-dd")+"' AND mcit_hora < '"+(fechaMomento.TimeOfDay.ToString()).Substring(0,8)+"' AND mcit_placa ='"+placa.Text+"'"); DBFunctions.Request(citasAnteriores, IncludeSchema.NO, "SELECT mcit_fecha, mcit_hora, mcit_codven, pkit_codigo, testcit_estacita FROM mcitataller WHERE mcit_fecha<'" + fechaMomento.Date.ToString("yyyy-MM-dd") + "' AND mcit_placa ='" + placa.Text + "'"); for (i = 0; i < citasAnteriores.Tables[0].Rows.Count; i++) { retorno = true; DataRow fila = tablaCitasAnteriores.NewRow(); fila["SEDE"] = DBFunctions.SingleData("SELECT palm_descripcion FROM palmacen WHERE TVIG_VIGENCIA='V' and palm_almacen=(SELECT palm_almacen FROM pvendedor WHERE pven_codigo='" + citasAnteriores.Tables[0].Rows[i][2].ToString() + "')"); fila["RECEPCIONISTA"] = DBFunctions.SingleData("SELECT pven_nombre FROM pvendedor WHERE pven_codigo='" + citasAnteriores.Tables[0].Rows[i][2].ToString() + "'"); fila["FECHA"] = (System.Convert.ToDateTime(citasAnteriores.Tables[0].Rows[i][0].ToString())).Date.ToString("yyyy-MM-dd"); fila["HORA"] = citasAnteriores.Tables[0].Rows[i][1].ToString(); fila["SERVICIO"] = DBFunctions.SingleData("SELECT pkit_nombre FROM pkit WHERE PKIT_VIGENCIA = 'V' and pkit_codigo='" + citasAnteriores.Tables[0].Rows[i][3].ToString() + "'"); fila["ESTADO DE LA CITA"] = DBFunctions.SingleData("SELECT testcit_desccita FROM testadocita WHERE testcit_estacita='" + citasAnteriores.Tables[0].Rows[i][4].ToString() + "'"); tablaCitasAnteriores.Rows.Add(fila); } grilla.DataSource = tablaCitasAnteriores; grilla.DataBind(); DatasToControls.Aplicar_Formato_Grilla(grilla); labelHistorial.Text = "Su carro ha tenido un total de " + citasAnteriores.Tables[0].Rows.Count.ToString() + " en nuestros talleres"; return(retorno); }
private void EnlazarGrilla() { dgProduccion.DataSource = dtProduccion; dgProduccion.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgProduccion); Session["dtProduccion"] = dtProduccion; }
protected void Crear_Grilla_Configuracion(int razon) { if (razon == 0) { this.Preparar_Tabla_Configuracion(System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_filaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + catalogoBus.SelectedItem.ToString() + "'")), System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_columnaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + catalogoBus.SelectedItem.ToString() + "'"))); grillaConfiguracion.DataSource = tablaConfiguracion; grillaConfiguracion.DataBind(); DatasToControls.Aplicar_Formato_Grilla(grillaConfiguracion); this.Llenar_Grilla_DropDownLists(System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_filaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + catalogoBus.SelectedItem.ToString() + "'")), System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_columnaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + catalogoBus.SelectedItem.ToString() + "'"))); Session["catalogo"] = catalogoBus.SelectedItem.ToString(); botonGuardar.Visible = true; } else if (razon == 1) { if (Session["catalogo"] != null) { this.Preparar_Tabla_Configuracion(System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_filaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + Session["catalogo"].ToString() + "'")), System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_columnaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + Session["catalogo"].ToString() + "'"))); grillaConfiguracion.DataSource = tablaConfiguracion; grillaConfiguracion.DataBind(); DatasToControls.Aplicar_Formato_Grilla(grillaConfiguracion); this.Llenar_Grilla_DropDownLists(System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_filaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + Session["catalogo"].ToString() + "'")), System.Convert.ToInt32(DBFunctions.SingleData("SELECT pcat_columnaspuestos FROM pcatalogovehiculo WHERE pcat_codigo='" + Session["catalogo"].ToString() + "'"))); botonGuardar.Visible = true; } } }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Construir_Grillas() { codigosGruposPeritaje = new ArrayList(); DataSet gruposPeritajeConstruccion = new DataSet(); DBFunctions.Request(gruposPeritajeConstruccion, IncludeSchema.NO, "SELECT * FROM pgrupoperitaje"); cantidadGrillas = gruposPeritajeConstruccion.Tables[0].Rows.Count; Session["cantidadGrillas"] = cantidadGrillas; grillasGruposPeritaje = new DataGrid[cantidadGrillas]; tablasAsociadas = new DataTable[cantidadGrillas]; for (int i = 0; i < cantidadGrillas; i++) { DataTable tablaAsociada = new DataTable(); this.Construir_Tabla(tablaAsociada, gruposPeritajeConstruccion.Tables[0].Rows[i][1].ToString()); DataGrid grilla = new DataGrid(); grilla.Width = new Unit(700); grilla.EnableViewState = true; gruposPeritaje.Controls.Add(new LiteralControl("<br><br>")); gruposPeritaje.Controls.Add(grilla); this.Llenar_Grilla(grilla, tablaAsociada, gruposPeritajeConstruccion.Tables[0].Rows[i][0].ToString(), gruposPeritajeConstruccion.Tables[0].Rows[i][1].ToString()); DatasToControls.Aplicar_Formato_Grilla(grilla); tablasAsociadas[i] = tablaAsociada; codigosGruposPeritaje.Add(gruposPeritajeConstruccion.Tables[0].Rows[i][0].ToString()); } Session["tablasAsociadas"] = tablasAsociadas; Session["codigosGruposPeritaje"] = codigosGruposPeritaje; }
//Carga Kits corespondientes a un grupo de catalogo y pinta grilla private void cargarKits() { string grupo = (string)ViewState["grupo"]; DataSet ds = new DataSet(); DBFunctions.Request(ds, IncludeSchema.NO, "Select pkit_codigo, pkit_nombre from PKIT where pgru_grupo = '" + grupo + "'"); dtKits = ds.Tables[0]; dgKits.DataSource = dtKits; DatasToControls.Aplicar_Formato_Grilla(dgKits); dgKits.DataBind(); Session["dtKits"] = dtKits; //asigna sesion ' EJ: guarda datatable' }
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 ConstruirGrilla() { bool deb = false, cre = false; DatasToControls.Aplicar_Formato_Grilla(dgMovs); Estructura_DtMovs(); for (int i = 0; i < dtCabeceras.Rows.Count; i++) { DataRow[] hijos = dtDetalles.Select("PREFIJO='" + dtCabeceras.Rows[i][0].ToString() + "' AND NUMERO='" + dtCabeceras.Rows[i][1].ToString() + "'"); valorCredito = valorDebito = 0; if (hijos.Length != 0) { ConstruirHeader(dtCabeceras.Rows[i][0].ToString(), dtCabeceras.Rows[i][1].ToString(), dtCabeceras.Rows[i][2].ToString(), dtCabeceras.Rows[i][3].ToString(), dtCabeceras.Rows[i][4].ToString(), dtCabeceras.Rows[i][5].ToString(), dtCabeceras.Rows[i][6].ToString(), dtCabeceras.Rows[i][7].ToString(), dtCabeceras.Rows[i][8].ToString()); for (int j = 0; j < hijos.Length; j++) { deb = cre = false; if (hijos[j][9].ToString() != string.Empty) //Debito { try { valorDebito = valorDebito + Math.Round(Convert.ToDouble(hijos[j][9].ToString().Substring(1)), 2); deb = true; } catch { valorDebito = valorDebito + 0; } } if (hijos[j][10].ToString() != string.Empty) //Credito { try { valorCredito = valorCredito + Math.Round(Convert.ToDouble(hijos[j][10].ToString().Substring(1)), 2); cre = true; } catch { valorCredito = valorCredito + 0; } } if (deb && cre) { if (Convert.ToDouble(hijos[j][9].ToString().Substring(1)) != 0 || Convert.ToDouble(hijos[j][10].ToString().Substring(1)) != 0) { // para no sobre cargart (temporal}... se usa la intruccion de abajo. } ConstruirItems(hijos[j][2].ToString(), hijos[j][3].ToString(), hijos[j][4].ToString(), hijos[j][5].ToString(), hijos[j][6].ToString(), hijos[j][7].ToString(), hijos[j][8].ToString(), hijos[j][9].ToString(), hijos[j][10].ToString(), hijos[j][11].ToString(), hijos[j][12].ToString(), hijos[j][13].ToString(), dtCabeceras.Rows[i][0].ToString(), dtCabeceras.Rows[i][1].ToString()); } } ConstruirTotalComprobante(); } } dgMovs.DataSource = dtMovs; dgMovs.DataBind(); if (hdnCont.Value == "S") { CmdContabilizar.Visible = lnkExportarExcel.Visible = true; } }
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(string codigo, string nombre, double valor) { DataRow fila = dtGastos.NewRow(); fila["CODIGO"] = codigo; fila["NOMBRE"] = nombre; fila["COSTO"] = valor; dtGastos.Rows.Add(fila); dgGastos.DataSource = dtGastos; dgGastos.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgGastos); //DatasToControls.JustificacionGrilla(DATAGRIDPERESCOGIDO,DataTable2); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { Session.Clear(); if (Request.QueryString["exito"] != null) { Utils.MostrarAlerta(Response, "GARANTIA VALIDA "); } lbCodcat.Text = Request.QueryString["catalogo"]; DataSet cgarantia = new DataSet(); DBFunctions.Request(cgarantia, IncludeSchema.NO, "select * from cgarantia"); lbGrupo.Text = DBFunctions.SingleData("select pgru_grupo from pcatalogovehiculo where pcat_codigo = '" + lbCodcat.Text + "'").ToString(); lbNoncat.Text = DBFunctions.SingleData("select pcat_descripcion from pcatalogovehiculo where pcat_codigo = '" + lbCodcat.Text + "'").ToString(); dtRepuestos = new DataTable(); dtOperaciones = new DataTable(); dtOperaciones.Columns.Add("ptem_operacion"); dtOperaciones.Columns.Add("ptem_descripcion"); dtOperaciones.Columns.Add("Valor", typeof(double)); dtOperaciones.Columns.Add("exeivaOper"); dtOperaciones.Columns.Add("ivaOper"); dtOperaciones.Columns.Add("cubresn"); dtOperaciones.Columns.Add("tipoliq"); dtRepuestos.Columns.Add("Codigo"); dtRepuestos.Columns.Add("ITEM"); dtRepuestos.Columns.Add("ValorIt"); dtRepuestos.Columns.Add("linea"); dtRepuestos.Columns.Add("cantidad"); dtRepuestos.Columns.Add("cubresino"); dgItems.DataSource = dtRepuestos; dgOpers.DataSource = dtOperaciones; dgItems.DataBind(); dgOpers.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgItems); DatasToControls.Aplicar_Formato_Grilla(dgOpers); Session["dtRepuestos"] = dtRepuestos; Session["dtOperaciones"] = dtOperaciones; Session["cgarantia"] = cgarantia; } else { dtRepuestos = (DataTable)Session["dtRepuestos"]; dtOperaciones = (DataTable)Session["dtOperaciones"]; cgarantia = (DataSet)Session["cgarantia"]; cargarValores(); } }
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 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 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 Page_Load(object sender, System.EventArgs e) { Session.Clear(); DatasToControls.Aplicar_Formato_Grilla(dgConsulta); if (!IsPostBack) { plFil2.Visible = plFil3.Visible = false; DatasToControls bind = new DatasToControls(); bind.PutDatasIntoDropDownList(ddlLinea, "SELECT plin_codigo CONCAT '-' CONCAT plin_tipo, plin_nombre FROM plineaitem"); tbFiltroCodI.Attributes.Add("ondblclick", "MostrarRefs(" + tbFiltroCodI.ClientID + "," + ddlLinea.ClientID + ");"); tbFiltroCodI.Attributes.Add("onkeyup", "ItemMask(" + tbFiltroCodI.ClientID + "," + ddlLinea.ClientID + ");"); ddlLinea.Attributes.Add("onchange", "ChangeLine(" + ddlLinea.ClientID + "," + tbFiltroCodI.ClientID + ");"); //Traemos los prefijos de los pedidos que tienen pendientes bind.PutDatasIntoDropDownList(ddlPrefPed, "SELECT DISTINCT PPE.pped_codigo,PPE.pped_nombre FROM ppedido PPE, dpedidoitem DPI WHERE PPE.pped_codigo=DPI.pped_codigo AND (DPI.dped_cantpedi-DPI.dped_cantasig-DPI.dped_cantfact)>0"); bind.PutDatasIntoDropDownList(ddlNumPed, "SELECT DISTINCT DPI.mped_numepedi FROM ppedido PPE, dpedidoitem DPI WHERE PPE.pped_codigo=DPI.pped_codigo AND (DPI.dped_cantpedi-DPI.dped_cantasig-DPI.dped_cantfact)>0 AND DPI.pped_codigo='" + ddlPrefPed.SelectedValue + "'"); } }
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 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 ConstruirGrilla() { DatasToControls.Aplicar_Formato_Grilla(dgMovs); Estructura_DtMovs(); dtCabeceras = dsInterface.Tables[0]; dtDetalles = dsInterface.Tables[1]; for (int i = 0; i < dtCabeceras.Rows.Count; i++) { DataRow[] hijos = dtDetalles.Select("PREFIJO='" + dtCabeceras.Rows[i][0].ToString() + "' AND NUMERO='" + dtCabeceras.Rows[i][1].ToString() + "'"); valorCredito = valorDebito = 0; if (hijos.Length != 0) { ConstruirHeader(dtCabeceras.Rows[i][0].ToString(), dtCabeceras.Rows[i][1].ToString(), dtCabeceras.Rows[i][2].ToString(), dtCabeceras.Rows[i][3].ToString(), dtCabeceras.Rows[i][4].ToString(), dtCabeceras.Rows[i][5].ToString(), dtCabeceras.Rows[i][6].ToString(), dtCabeceras.Rows[i][7].ToString(), dtCabeceras.Rows[i][8].ToString()); for (int j = 0; j < hijos.Length; j++) { if (!hijos[j][9].ToString().Equals("0")) //Debito { try { valorDebito = valorDebito + Math.Round(Convert.ToDouble(hijos[j][9].ToString().Substring(1)), 2); } catch { valorDebito = valorDebito + 0; } } if (!hijos[j][10].ToString().Equals("0")) //Credito { try { valorCredito = valorCredito + Math.Round(Convert.ToDouble(hijos[j][10].ToString().Substring(1)), 2); } catch { valorCredito = valorCredito + 0; } } ConstruirItems(hijos[j][2].ToString(), hijos[j][3].ToString(), hijos[j][4].ToString(), hijos[j][5].ToString(), hijos[j][6].ToString(), hijos[j][7].ToString(), hijos[j][8].ToString(), hijos[j][9].ToString(), hijos[j][10].ToString(), hijos[j][11].ToString(), dtCabeceras.Rows[i][0].ToString(), dtCabeceras.Rows[i][1].ToString()); } ConstruirTotalComprobante(); } } dgMovs.DataSource = dtMovs; dgMovs.DataBind(); btnCancelar.Visible = CmdContabilizar.Visible = lnkExportarExcel.Visible = (dtMovs.Rows.Count > 0); Session["dtCabeceras"] = dtCabeceras; Session["dtDetalles"] = dtDetalles; }
//lo mismo de cargarOpers pero con los repuestos private void cargarRepuestos(DataTable Repuestos) { string str = ""; bool ban = true; DataRow[] rep = null; for (int i = 0; i < Repuestos.Rows.Count; i++) { rep = dtRepuestos.Select("Codigo='" + Repuestos.Rows[i][0].ToString() + "'"); if (rep.Length == 0) { DataRow fila; fila = dtRepuestos.NewRow(); fila["Codigo"] = Repuestos.Rows[i][0].ToString(); fila["ITEM"] = Repuestos.Rows[i][1].ToString(); fila["linea"] = Repuestos.Rows[i][3].ToString(); Referencias.Guardar(Repuestos.Rows[i][0].ToString(), ref str, DBFunctions.SingleData("SELECT plin_tipo FROM plineaitem WHERE plin_codigo='" + (Repuestos.Rows[i][3].ToString().Split('-'))[0] + "'")); fila["cantidad"] = 1; fila["cubresino"] = repuestosCubreSN(str); fila["ValorIt"] = DBFunctions.SingleData("select mpre_precio from mprecioitem where mite_codigo = '" + str + "' and ppre_codigo = '" + cgarantia.Tables[0].Rows[0][5] + "' "); dtRepuestos.Rows.Add(fila); } } Session["dtRepuestos"] = dtRepuestos; dgItems.DataSource = dtRepuestos; DatasToControls.Aplicar_Formato_Grilla(dgItems); dgItems.DataBind(); for (int i = 0; i < dgItems.Items.Count; i++) { if (dtRepuestos.Rows[i][5].ToString() == "No") { dgItems.Items[i].Cells[5].BackColor = Color.Orange; lbParcial.Text = "Esta solicitud contiene repuestos que no son cubiertos por garantía; En caso de ser aprobada estos repuestos correran por cuenta del cliente."; e1.Visible = true; ban = false; } if (ban) { lbParcial.Text = ""; } } }
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 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; } } }
//Cargar operaciones Correspondientes al Kit seleccionado sin reperir las ya incluidas private void cargarOpers(DataTable oper) { if (dtOperaciones == null) { dtOperaciones = new DataTable(); } if (dtOperaciones.Rows.Count == 0) //si la tabala de repuestos esta vacia { dtOperaciones = oper; dgOpers.DataSource = dtOperaciones; DatasToControls.Aplicar_Formato_Grilla(dgOpers); dgOpers.DataBind(); Session["dtOperaciones"] = dtOperaciones; //asigna sesion ' EJ: guarda datatable' } else { string c1 = dtOperaciones.Columns[0].ColumnName.ToString(); string c2 = dtOperaciones.Columns[1].ColumnName.ToString(); DataRow[] rep = null; for (int i = 0; i < oper.Rows.Count; i++) { rep = dtOperaciones.Select("ptem_operacion='" + oper.Rows[i][0].ToString() + "'"); if (rep.Length == 0) { DataRow fila; fila = dtOperaciones.NewRow(); fila["ptem_operacion"] = oper.Rows[i][0].ToString(); fila["ptem_descripcion"] = oper.Rows[i][1].ToString(); dtOperaciones.Rows.Add(fila); } } Session["dtOperaciones"] = dtOperaciones; dgOpers.DataSource = dtOperaciones; DatasToControls.Aplicar_Formato_Grilla(dgOpers); dgOpers.DataBind(); } }
//lo mismo de cargarOpers pero con los repuestos private void cargarRepuestos(DataTable Repuestos) { if (dtRepuestos == null) { dtRepuestos = new DataTable(); } if (dtRepuestos.Rows.Count == 0) //si la tabala de repuestos esta vacia { dtRepuestos = Repuestos; dgItems.DataSource = dtRepuestos; DatasToControls.Aplicar_Formato_Grilla(dgItems); dgItems.DataBind(); Session["dtRepuestos"] = dtRepuestos; //asigna sesion ' EJ: guarda datatable' } else { DataRow[] rep = null; for (int i = 0; i < Repuestos.Rows.Count; i++) { rep = dtRepuestos.Select("Codigo='" + Repuestos.Rows[i][0].ToString() + "'"); if (rep.Length == 0) { DataRow fila; fila = dtRepuestos.NewRow(); fila["Codigo"] = Repuestos.Rows[i][0].ToString(); fila["ITEM"] = Repuestos.Rows[i][1].ToString(); fila["linea"] = Repuestos.Rows[i][4].ToString(); dtRepuestos.Rows.Add(fila); } } Session["dtRepuestos"] = dtRepuestos; dgItems.DataSource = dtRepuestos; DatasToControls.Aplicar_Formato_Grilla(dgItems); dgItems.DataBind(); } }
protected void Generar_Reporte(Object Sender, EventArgs e) { resultadoReporte.Controls.Clear(); //Primero debemos comprobar que las fechas cumplan la condicion if (fechaFinal.SelectedDate.Date > fechaInicial.SelectedDate.Date) { //Construimos los ArrayList que van a contener los totales de los resultados codigosResultadoTotales = new ArrayList(); cantidadOrdenesTotales = new ArrayList(); this.Construir_Contadores_Resultados(codigosResultadoTotales, cantidadOrdenesTotales); //Fin de construccion int i, controlBucle = 0, cantidadGrillas = 0; //Luego determinamos cuales son las actividades DataSet actividadesMarketing = new DataSet(); DBFunctions.Request(actividadesMarketing, IncludeSchema.NO, "SELECT pact_codimark, pact_nombmark FROM pactividadmarketing WHERE pmar_codimark='" + DBFunctions.SingleData("SELECT pmar_codimark FROM pmarketing WHERE pmar_nombmark='" + tipoAcciones.SelectedItem.ToString() + "'") + "'"); //Ahora traemos todas las ordenes de trabajo que se encuentran dentro de las fechas seleccionadas DataSet ordenesSeleccionadas = new DataSet(); DBFunctions.Request(ordenesSeleccionadas, IncludeSchema.NO, "SELECT pdoc_codigo, mord_numeorde , mnit_nit FROM morden WHERE mord_entrada>='" + fechaInicial.SelectedDate.ToString("yyyy-MM-dd") + "' AND mord_entrada<='" + fechaFinal.SelectedDate.ToString("yyyy-MM-dd") + "'"); cantidadCitas = ordenesSeleccionadas.Tables[0].Rows.Count; //Ahora por cada actividad vamos a generar las consultas correspondientes string opcion = tipoOrden.SelectedValue.ToString(); if (opcion == "orden") { controlBucle = ordenesSeleccionadas.Tables[0].Rows.Count; } else if (opcion == "actividad") { controlBucle = actividadesMarketing.Tables[0].Rows.Count; } dtgs = new DataGrid[controlBucle]; tablasAsociadas = new DataSet(); //Iniciamos la creacion de los DataGrids dentro del Bucle de acuerdo a la opcion seleccionada por el usuario for (i = 0; i < controlBucle; i++) { Label subtitulo = new Label(); DataTable subtablaAsociada = new DataTable(); DataGrid grillaInformativa = new DataGrid(); Label resultado = new Label(); bool mostrar = true; if (opcion == "orden") { this.Contruir_Label_Opcion1(subtitulo, ordenesSeleccionadas.Tables[0].Rows[i][0].ToString(), ordenesSeleccionadas.Tables[0].Rows[i][1].ToString()); mostrar = this.Llenar_Tabla_Opcion1(grillaInformativa, subtablaAsociada, ordenesSeleccionadas.Tables[0].Rows[i][0].ToString(), ordenesSeleccionadas.Tables[0].Rows[i][1].ToString()); } else if (opcion == "actividad") { this.Contruir_Label_Opcion2(subtitulo, actividadesMarketing.Tables[0].Rows[i][0].ToString()); mostrar = this.Llenar_Tabla_Opcion2(grillaInformativa, subtablaAsociada, actividadesMarketing.Tables[0].Rows[i][0].ToString()); this.Construir_Label_Resultados(resultado, codigoResultado, cantidadOrdenes); } if (mostrar) { resultadoReporte.Controls.Add(new LiteralControl("<br><br>")); resultadoReporte.Controls.Add(subtitulo); resultadoReporte.Controls.Add(grillaInformativa); resultadoReporte.Controls.Add(resultado); dtgs[cantidadGrillas] = grillaInformativa; cantidadGrillas += 1; DatasToControls.Aplicar_Formato_Grilla(grillaInformativa); } } //Aqui vamos a crear un label que nos muestre los totales Label totales = new Label(); resultadoReporte.Controls.Add(totales); Construir_Label_Total(totales, codigosResultadoTotales, cantidadOrdenesTotales); toolsHolder.Visible = true; Session["Rep"] = this.Html_Writer(resultadoReporte); } else { Utils.MostrarAlerta(Response, "Fechas Invalidas. Por Favor Verifique los calendarios"); } }
//protected Hashtable valoresAguardar; #endregion protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["exito"] != null) { Utils.MostrarAlerta(Response, "Transacción Exitosa"); } if (DBFunctions.RecordExist("Select cgar_prefot from CGARANTIA")) { Session.Clear(); lbPrefOrden.Text = DBFunctions.SingleData("Select cgar_prefot from CGARANTIA"); string nitdealer, ciudad; //*******carga los datos del dealer en el form********** string usuario = HttpContext.Current.User.Identity.Name; //nombre del usuario lblUsuario.Text = DBFunctions.SingleData("Select susu_nombre from DBXSCHEMA.SUSUARIO where susu_login='******'"); //nit del usuario nitdealer = Convert.ToString(DBFunctions.SingleData("Select mnit_nit from DBXSCHEMA.SUSUARIO where susu_login='******'")); lblNitDealer.Text = nitdealer; if (nitdealer != null && nitdealer != "") { lblCiudad.Text = DBFunctions.SingleData("Select pciu_nombre from DBXSCHEMA.MCLIENTE, dbxschema.pciudad where pciu_codigo = pcui_codigo and mnit_nit ='" + nitdealer + "'"); //ciudad del usuario ciudad = DBFunctions.SingleData("Select pcui_codigo from DBXSCHEMA.MCLIENTE where mnit_nit ='" + nitdealer + "'"); Panel1.Enabled = true; Panel3.Visible = false; Panel4.Visible = false; btGuardar.Visible = false; dtRepuestos = new DataTable(); dtOperaciones = new DataTable(); ArrayList kitsAplicados = new ArrayList(); dtOperaciones.Columns.Add("ptem_operacion"); dtOperaciones.Columns.Add("ptem_descripcion"); dtOperaciones.Columns.Add("Valor"); dtRepuestos.Columns.Add("Codigo"); dtRepuestos.Columns.Add("ITEM"); dtRepuestos.Columns.Add("cantidad"); dtRepuestos.Columns.Add("ValorIt"); dtRepuestos.Columns.Add("linea"); dgItems.DataSource = dtRepuestos; dgOpers.DataSource = dtOperaciones; dgItems.DataBind(); dgOpers.DataBind(); DatasToControls.Aplicar_Formato_Grilla(dgItems); DatasToControls.Aplicar_Formato_Grilla(dgOpers); dgItems.Visible = false; dgOpers.Visible = false; Session["dtRepuestos"] = dtRepuestos; Session["dtOperaciones"] = dtOperaciones; Session["kitsAplicados"] = kitsAplicados; } else { //El dealer debe tener registrado el nit en la tabla SUSUARIO para poder ingresar Utils.MostrarAlerta(Response, " ERROR Debe asignar un Nit al usuario"); Panel1.Visible = false; } } else { Utils.MostrarAlerta(Response, " Deben configurarse los parametros de garantias"); } } else { if (Session["dtKits"] != null) { dtKits = (DataTable)Session["dtKits"]; } if (Session["dtRepuestos"] != null) { dtRepuestos = (DataTable)Session["dtRepuestos"]; } if (Session["dtOperaciones"] != null) { dtOperaciones = (DataTable)Session["dtOperaciones"]; } if (Session["kitsAplicados"] != null) { kitsAplicados = (ArrayList)Session["kitsAplicados"]; } } }
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; } } }
//agrega operaciones sin repetir a la grilla de operaciones private void cargarOpers(DataTable oper) { DataRow[] rep = null; for (int i = 0; i < oper.Rows.Count; i++) { rep = dtOperaciones.Select("ptem_operacion='" + oper.Rows[i][0].ToString() + "'"); if (rep.Length == 0) { DataRow fila; fila = dtOperaciones.NewRow(); fila["ptem_operacion"] = oper.Rows[i][0].ToString(); fila["ptem_descripcion"] = oper.Rows[i][1].ToString(); fila["exeivaOper"] = oper.Rows[i][3].ToString(); fila["ivaOper"] = oper.Rows[i][4].ToString(); fila["cubresn"] = "S"; string tipoLiquidacion = DBFunctions.SingleData("SELECT ttip_codiliqu FROM ptempario WHERE ptem_operacion='" + oper.Rows[i][0].ToString() + "'"); fila["tipoliq"] = tipoLiquidacion; double porcentajeIva = Convert.ToDouble(DBFunctions.SingleData("SELECT cemp_porciva FROM cempresa")); double valorOperacion = 0, valorHora = 0, tiempoGarantia = 0; bool nogarantia = false; if (tipoLiquidacion == "F") { valorOperacion = Convert.ToDouble(DBFunctions.SingleData("SELECT ptem_valooper FROM ptempario WHERE ptem_operacion='" + oper.Rows[i][0].ToString() + "'")); } else if (tipoLiquidacion == "T") { valorHora = Convert.ToDouble(DBFunctions.SingleData("SELECT ppreta_valohoragtia FROM ppreciotaller WHERE ppreta_codigo='" + cgarantia.Tables[0].Rows[0][4] + "'")); if (valorHora == 0) { nogarantia = true; } try { tiempoGarantia = Convert.ToDouble(DBFunctions.SingleData("SELECT ptie_tiemgara FROM ptiempotaller WHERE ptie_grupcata='" + lbGrupo.Text + "' AND ptie_tempario='" + oper.Rows[i][0].ToString() + "'")); if (tiempoGarantia == 0) { nogarantia = true; } if (nogarantia) { tiempoGarantia = Convert.ToDouble(DBFunctions.SingleData("SELECT ptie_tiemclie FROM ptiempotaller WHERE ptie_grupcata='" + lbGrupo.Text + "' AND ptie_tempario='" + oper.Rows[i][0].ToString() + "'")); valorHora = Convert.ToDouble(DBFunctions.SingleData("SELECT ppreta_valohoraclie FROM ppreciotaller WHERE ppreta_codigo='" + cgarantia.Tables[0].Rows[0][4] + "'")); } } catch { if (Convert.ToDouble(DBFunctions.SingleData("SELECT ptem_tiempoestandar FROM dbxschema.ptempario WHERE ptem_operacion='" + oper.Rows[i][0].ToString() + "'")) == 0) { tiempoGarantia = 1; } else { tiempoGarantia = Convert.ToDouble(DBFunctions.SingleData("SELECT ptem_tiempoestandar FROM dbxschema.ptempario WHERE ptem_operacion='" + oper.Rows[i][0].ToString() + "'")); } } //valorOperacion = (Convert.ToDouble(DBFunctions.SingleData("SELECT ppreta_valohoraclie FROM ppreciotaller WHERE ppreta_codigo='"+listaPrecios+"'")))*(Convert.ToDouble(DBFunctions.SingleData("SELECT ptie_tiemclie FROM ptiempotaller WHERE ptie_grupcata='"+grupoCatalogo+"' AND ptie_tempario='"+((TextBox)e.Item.Cells[1].Controls[1]).Text+"'"))); valorOperacion = valorHora * tiempoGarantia; } if (tipoLiquidacion != "B") { if (oper.Rows[i][3].ToString() == "N") { valorOperacion = valorOperacion + (valorOperacion * (porcentajeIva / 100)); } } fila["Valor"] = valorOperacion; dtOperaciones.Rows.Add(fila); } } Session["dtOperaciones"] = dtOperaciones; dgOpers.DataSource = dtOperaciones; DatasToControls.Aplicar_Formato_Grilla(dgOpers); dgOpers.DataBind(); bool ban = true; for (int i = 0; i < dgOpers.Items.Count; i++) { double tiempoGarantia = 0, valorHora = 0; try { tiempoGarantia = Convert.ToDouble(DBFunctions.SingleData("SELECT ptie_tiemgara FROM ptiempotaller WHERE ptie_grupcata='" + lbGrupo.Text + "' AND ptie_tempario='" + oper.Rows[i][0].ToString() + "'")); valorHora = Convert.ToDouble(DBFunctions.SingleData("SELECT ppreta_valohoragtia FROM ppreciotaller WHERE ppreta_codigo='" + cgarantia.Tables[0].Rows[0][4] + "'")); } catch { dgOpers.Items[i].Cells[0].BackColor = Color.Orange; lbParcial2.Text = "Esta solicitud contiene Operaciónes que no son cubiertas por garantía; En caso de ser aprobada estas Operaciónes correran por cuenta del cliente."; dtOperaciones.Rows[i][5] = "N"; } if (tiempoGarantia == 0 || valorHora == 0) { dgOpers.Items[i].Cells[0].BackColor = Color.Orange; lbParcial2.Text = "Esta solicitud contiene Operaciónes que no son cubiertas por garantía; En caso de ser aprobada estas Operaciónes correran por cuenta del cliente."; dtOperaciones.Rows[i][5] = "N"; e2.Visible = true; ban = false; } if (ban) { lbParcial2.Text = ""; } } }