Ejemplo n.º 1
0
 public void UpdateTime()
 {
     ustDateTime = nServerTime.GetCurrentServerTime();
     PST.UpdateZoneTime(ustDateTime);
     MST.UpdateZoneTime(ustDateTime);
     CST.UpdateZoneTime(ustDateTime);
     EST.UpdateZoneTime(ustDateTime);
     CurrVSServ.updateTime(ustDateTime);
 }
        private string ObtenerOpcion(string sIdCli, string sCR, string cboArea, Nullable <bool> activas, Nullable <bool> clienteNulo)
        {
            string sResul = "", sFecha;
            int?   iCodCli = null, iCR = null;

            try
            {
                StringBuilder sb = new StringBuilder();

                if (sIdCli != "")
                {
                    iCodCli = int.Parse(sIdCli);
                }
                if (sCR != "")
                {
                    iCR = int.Parse(sCR);
                }
                sb.Append("<table id='tblOpciones' class='texto MA' style='width: 850px;'>");
                sb.Append("<colgroup><col style='width:200px;'><col style='width:275px'><col style='width:250px'><col style='width:125px;'></colgroup>");
                SqlDataReader dr = PST.Catalogo(null, iCR, "", "", activas, iCodCli, null, "", null, cboArea, clienteNulo);
                while (dr.Read())
                {
                    sb.Append("<tr id='" + dr["t346_idpst"].ToString() + "' ondblclick='aceptarClick(this.rowIndex)'>");
                    if ((bool)dr["t346_estado"])
                    {
                        sb.Append("<td style='padding-left:5px;'>" + dr["t346_codpst"].ToString() + "</td>");
                    }
                    else
                    {
                        sb.Append("<td style='padding-left:5px; color:red'>" + dr["t346_codpst"].ToString() + "</td>");
                    }
                    sb.Append("<td title='" + dr["t346_despst"].ToString() + "'><nobr class='NBR W270'>" + dr["t346_despst"].ToString() + "</nobr></td>");
                    sb.Append("<td><nobr class='NBR W245'>" + dr["nom_cliente"].ToString() + "</nobr></td>");
                    if (dr["t346_fecharef"].ToString() == "")
                    {
                        sFecha = "";
                    }
                    else
                    {
                        sFecha = DateTime.Parse(dr["t346_fecharef"].ToString()).ToShortDateString();
                    }
                    sb.Append("<td align='center'>" + sFecha + "</td></tr>");
                }
                dr.Close();
                dr.Dispose();

                sb.Append("</table>");

                sResul = "OK@#@" + sb.ToString();
            }
            catch (Exception ex)
            {
                sResul = "Error@#@" + Errores.mostrarError("Error al obtener las ordenes de trabajo codificadas", ex);
            }
            return(sResul);
        }
Ejemplo n.º 3
0
        protected void ddlType_IndexChanged(object sender, EventArgs e)
        {
            if (txtToDate.Text == "" && txtFromDate.Text == "")
            {
                lblMessage.Text = "Please Select Dates";
                return;
            }

            LoadEmptyGrid();

            lblMessage.Text = string.Empty;
            SqlParameter[] param =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),           //0
                new SqlParameter("@Type",       SqlDbType.Char, 3),           //0
                new SqlParameter("@FromDate",   SqlDbType.DateTime),          //0
                new SqlParameter("@ToDate",     SqlDbType.DateTime),          //0
            };
            param[0].Value = Session["DealerCode"].ToString();
            param[1].Value = ddlTypes.SelectedValue;
            param[2].Value = sysFunc.SaveDate(txtFromDate.Text);
            param[3].Value = sysFunc.SaveDate(txtToDate.Text);

            ds = ObjGenral.FillDataSet("sp_2W_Service_GetClaimBillingData_new", param);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Grdbillings.DataSource = ds;
                Grdbillings.DataBind();
                Session["JENDetail"] = ds.Tables[0];

                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (GridViewRow gvr in Grdbillings.Rows)
                    {
                        PST         = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["HandlingAmount"].ToString()) + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["PSTSubletAmount"].ToString()) + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["PSTLaborAmount"].ToString());
                        GST         = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["GSTAmount"].ToString());
                        TotalAmount = TotalAmount + SysFunctions.CustomCDBL(ds.Tables[0].Rows[0]["TotalAmount"].ToString());
                        CheckBox Chk = (CheckBox)gvr.Cells[0].FindControl("ChkBox");
                        Chk.Checked = true;
                        //ChkBox.Checked = true;
                    }
                    txtLabPST.Text      = PST.ToString();
                    txtGSTAmt.Text      = GST.ToString();
                    txtTotalAmount.Text = TotalAmount.ToString();
                    //CalculatePSTPercentage();
                }
            }
            else
            {
                //txtPstAmt.Text = "";
                //txtPerc.Text = "";
                lblMessage.Text = "No Record Found !!!";
            }
        }
        private string ObtenerOpcion_Old(string sIdCli, string sCR, string cboArea, Nullable <bool> activas)
        {
            string sResul = "", sFecha;
            int?   iCodCli = null, iCR = null;

            try
            {
                StringBuilder sb = new StringBuilder();

                if (sIdCli != "")
                {
                    iCodCli = int.Parse(sIdCli);
                }
                if (sCR != "")
                {
                    iCR = int.Parse(sCR);
                }
                sb.Append("<table id='tblOpciones' class='texto MA' style='width: 850px;'>");
                sb.Append("<colgroup><col style='width:200px;'><col style='width:275px'><col style='width:250px'><col style='width:125px;'></colgroup>");
                //Solo PST en estado activo
                SqlDataReader dr = PST.Catalogo(null, iCR, "", "", activas, iCodCli, null, "", null, cboArea, null);
                while (dr.Read())
                {
                    sb.Append("<tr id='" + dr["t346_idpst"].ToString() + "' des=\"" + Utilidades.escape(dr["t346_despst"].ToString()) + "\" cli=\"" + Utilidades.escape(dr["nom_cliente"].ToString()) + "\">");
                    sb.Append("<td style='padding-left:5px;'>" + dr["t346_codpst"].ToString() + "</td>");
                    sb.Append("<td>" + dr["t346_despst"].ToString() + "</td>");
                    sb.Append("<td>" + dr["nom_cliente"].ToString() + "</td>");
                    if (dr["t346_fecharef"].ToString() == "")
                    {
                        sFecha = "";
                    }
                    else
                    {
                        sFecha = DateTime.Parse(dr["t346_fecharef"].ToString()).ToShortDateString();
                    }
                    sb.Append("<td align='center'>" + sFecha + "</td></tr>");
                }
                dr.Close();
                dr.Dispose();

                sb.Append("</table>");

                sResul = "OK@#@" + sb.ToString();
            }
            catch (Exception ex)
            {
                sResul = "Error@#@" + Errores.mostrarError("Error al obtener las ordenes de trabajo codificadas", ex);
            }
            return(sResul);
        }
Ejemplo n.º 5
0
    protected string Grabar(string strDatos)
    {
        string sResul = "", sElementosInsertados = "";
        int    nAux = 0;

        #region apertura de conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion

        try
        {
            string[] aClase = Regex.Split(strDatos, "///");
            foreach (string oClase in aClase)
            {
                if (oClase == "")
                {
                    continue;
                }
                string[] aValores = Regex.Split(oClase, "##");
                //0. Opcion BD. "I", "U", "D"
                //1. ID OTC
                //2. codigo OTC
                //3. Descripcion OTC
                //4. ID cliente
                //5. Fecha de referncia
                //6. Activo
                //7. Nodo
                //8 id OT externa;
                //9 id Origen Externo;
                //10 horas;
                //11 presupuesto;
                //12 id Moneda;

                bool bEstado = false;
                if (aValores[6] == "1")
                {
                    bEstado = true;
                }
                int?iCodCli;
                if (aValores[4] == "")
                {
                    iCodCli = null;
                }
                else
                {
                    iCodCli = int.Parse(aValores[4]);
                }
                int?idOTExt;
                if (aValores[8] == "")
                {
                    idOTExt = null;
                }
                else
                {
                    idOTExt = int.Parse(aValores[8]);
                }
                DateTime?dtFecha;
                if (aValores[5] == "")
                {
                    dtFecha = null;
                }
                else
                {
                    dtFecha = DateTime.Parse(aValores[5]);
                }

                decimal fHoras;
                if (aValores[10] == "")
                {
                    fHoras = 0;
                }
                else
                {
                    fHoras = Decimal.Parse(aValores[10]);
                }

                decimal fPresupuesto;
                if (aValores[11] == "")
                {
                    fPresupuesto = 0;
                }
                else
                {
                    fPresupuesto = Decimal.Parse(aValores[11]);
                }

                switch (aValores[0])
                {
                case "I":
                    nAux = PST.Insert(null, int.Parse(aValores[7]), Utilidades.unescape(aValores[2]),
                                      Utilidades.unescape(aValores[3]), bEstado, iCodCli, idOTExt, aValores[9], dtFecha, fHoras, fPresupuesto, aValores[12]);

                    if (sElementosInsertados == "")
                    {
                        sElementosInsertados = nAux.ToString();
                    }
                    else
                    {
                        sElementosInsertados += "//" + nAux.ToString();
                    }
                    break;

                case "U":
                    nAux = PST.Update(null, int.Parse(aValores[1]), int.Parse(aValores[7]), Utilidades.unescape(aValores[2]),
                                      Utilidades.unescape(aValores[3]), bEstado, iCodCli, idOTExt, aValores[9], dtFecha, fHoras, fPresupuesto, aValores[12]);
                    break;

                case "D":
                    PST.Delete(null, int.Parse(aValores[1]));
                    break;
                }
            }
            Conexion.CommitTransaccion(tr);

            sResul = "OK@#@" + sElementosInsertados;
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar las clases.", ex, false);// +"@#@" + sDesc;
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }

        return(sResul);
    }
Ejemplo n.º 6
0
    private string ObtenerPSTs(string sTipo, string sCR)
    {
        StringBuilder sb = new StringBuilder();
        bool?         bEstado;
        string        sEstado, sFecha;

        sb.Append("<table id='tblDatos' class='texto MANO' style='width:970px;' mantenimiento='1'>");
        sb.Append("<colgroup><col style='width:20px;' /><col style='width:110px;'><col style='width:245px'><col style='width:50px'><col style='width:80px'><col style='width:60px'><col style='width:80px;'><col style='width:40px;'><col style='width:285px'></colgroup>");
        sb.Append("<tbody>");
        //Si sTipo=T no restrinjo por estado de la PST, sino saco solo las activas
        if (sTipo == "T")
        {
            bEstado = null;
        }
        else
        {
            bEstado = true;
        }
        SqlDataReader dr = PST.Catalogo(null, int.Parse(sCR), "", "", bEstado, null, null, "", null, "", null);

        while (dr.Read())
        {
            sb.Append("<tr id='" + dr["t346_idpst"].ToString() + "' bd='' idOText='" + dr["idOTExterno"].ToString() + "' idOriExt='" + dr["idOrigenExterno"].ToString() + "'");

            sEstado = ((bool)dr["t346_estado"]) ? "1" : "0";
            sb.Append(" estado='" + sEstado + "'");
            sb.Append(" cli='" + dr["cod_cliente"].ToString() + "' style='height:20px'>");//onkeydown='activarGrabar()'

            sb.Append("<td></td>");

            sb.Append("<td style='padding-left:5px;'>" + dr["t346_codpst"].ToString() + "</td>");

            sb.Append("<td>" + dr["t346_despst"].ToString() + "</td>");

            sb.Append("<td>" + double.Parse(dr["t346_horas"].ToString()).ToString("#,##0.00") + "</td>");

            sb.Append("<td>" + double.Parse(dr["t346_presupuesto"].ToString()).ToString("#,##0.00") + "</td>");

            sb.Append("<td>" + dr["moneda"].ToString() + "</td>");

            if (dr["t346_fecharef"].ToString() == "")
            {
                sFecha = "";
            }
            else
            {
                sFecha = DateTime.Parse(dr["t346_fecharef"].ToString()).ToShortDateString();
            }

            sb.Append("<td>");
            sb.Append(sFecha);
            sb.Append("</td>");

            sb.Append("<td style='text-align:center'></td>");
            sb.Append("<td onmouseover='TTip(event)'><span class='NBR' style='width:260px'>" + dr["nom_cliente"].ToString() + "</span></td>");
            sb.Append("</tr>");
        }
        dr.Close();
        dr.Dispose();
        sb.Append("</tbody>");
        sb.Append("</table>");
        strTablaHtml = sb.ToString();

        return("OK@#@" + strTablaHtml);
    }