Esempio n. 1
0
        protected void ddljob_category_SelectedIndexChanged(object sender, EventArgs e)
        {
            String sql = "select DefJobCode,DefJobDesc,LaborAccount,StandardTime,BayCode from DefaultJob where  DealerCode in('" + Session["DealerCode"] + "','COMON') and JobCatCode = '" + ddljob_category.SelectedValue + "'";

            SysFunctions sysFunc = new SysFunctions();


            DataTable dt = new DataTable();
            DataSet   ds = new DataSet();

            sysFunc.ExecuteQuery(sql, ref ds);

            if (ds.Tables[0].Rows.Count > 0)
            {
                gv_labor.DataSource = ds;
                gv_labor.DataBind();
                Session["JobsDS"] = ds;
            }
            else
            {
                Create_Grid();
            }

            Session["LaborDS"] = ds;
        }
Esempio n. 2
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 !!!";
            }
        }
        protected void btnAdjAmt_Click(object sender, EventArgs e)
        {
            if (txtins_amount.Text == "")
            {
                SysFunc.UserMsg(success_add_item, Color.Red, "Please Enter Amount First!", txtins_amount);
            }
            double InsAmt, AdvBal;

            AdvBal          = SysFunctions.CustomCDBL(txtBalance.Text);
            InsAmt          = SysFunctions.CustomCDBL(txtins_amount.Text);
            AdvBal          = SysFunctions.CustomCDBL(AdvBal - InsAmt);
            txtBalance.Text = AdvBal.ToString();
            Session["Adj"]  = "Adj";
        }
Esempio n. 4
0
        private int GetTotalCount()

        {
            string sql   = "Select Count(*) from CustomerInvoice where Delflag='N' and DealerCode='" + Session["DealerCode"].ToString() + "'";
            int    count = 0;

            dt = new DataTable();
            dt = sysfun.GetData(sql);
            if (dt.Rows.Count > 0)
            {
                count = Convert.ToInt16(SysFunctions.CustomCDBL(dt.Rows[0][0].ToString()));
            }

            return(count);
        }
Esempio n. 5
0
        private void create_row()
        {
            DropDownList ddlbrand_code   = (DropDownList)gv_labor.FooterRow.FindControl("ddlbrand_code");
            DropDownList ddlprod_code    = (DropDownList)gv_labor.FooterRow.FindControl("ddlprod_code");
            DropDownList ddlVersion_code = (DropDownList)gv_labor.FooterRow.FindControl("ddlVersion_code");
            TextBox      txtTaxAmt       = (TextBox)gv_labor.FooterRow.FindControl("txtTaxAmt");
            TextBox      txtAmount       = (TextBox)gv_labor.FooterRow.FindControl("txtAmount");
            TextBox      txtStnTime      = (TextBox)gv_labor.FooterRow.FindControl("txtStnTime");
            Label        JobCode         = (Label)gv_labor.FindControl("lblJobCode");



            if (ddlbrand_code.SelectedIndex == 0)
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Select Made";
                return;
            }
            if (ddlprod_code.SelectedIndex == 0)
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Select Product ";
                return;
            }
            if (ddlVersion_code.SelectedIndex == 0)
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Select Version ";
                return;
            }
            if (txtTaxAmt.Text == "" || txtTaxAmt.Text == "0")
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Tax Amount cannot be empty or Zer(0)";
                return;
            }
            if (txtAmount.Text == "" || txtAmount.Text == "0")
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Amount cannot be empty or Zer(0)";
                return;
            }
            if (txtStnTime.Text == "" || txtStnTime.Text == "0")
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "Time can not be null";
                return;
            }

            try
            {
                DataTable    dt_newrow = new DataTable();
                SysFunctions SysFuncs  = new SysFunctions();
                ds = new DataSet();

                ds = (DataSet)Session["LaborDS"];

                DataRow row = ds.Tables[0].NewRow();

                row["DefJobCode"]   = ddlbrand_code.SelectedItem.Value;
                row["Made"]         = ddlbrand_code.SelectedItem.Text;
                row["Product"]      = ddlprod_code.SelectedItem.Value;
                row["Version"]      = ddlVersion_code.SelectedItem.Value;
                row["ServiceTax"]   = txtTaxAmt.Text;
                row["Amount"]       = txtAmount.Text;
                row["StandardTime"] = txtStnTime.Text;

                ds.Tables[0].Rows.Add(row);

                gv_labor.DataSource = ds.Tables[0];
                gv_labor.DataBind();

                Session["LaborDS"] = ds;
            }
            catch (Exception ex)
            {
                lblMsg.Visible = true;
                lblMsg.Text    = ex.Message;
            }
        }
Esempio n. 6
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            if (txtTaxHead.Text == "")
            {
                sysFuncs.UserMsg(lblMessage, Color.Red, "Tax Head should not left blank", txtTaxHead);
                return;
            }
            //if (txt.Text == "")
            //{
            //    sysFuncs.UserMsg(lblMessage, Color.Red, "Customer should not left blank", txtreg);
            //    return;
            //}
            //if (txtRemarks.Text == "")
            //{
            //    sysFuncs.UserMsg(lblMessage, Color.Red, "Remarks should not left blank", txtreg);
            //    return;
            //}


            DataTable dt = (DataTable)Session["TaxTypeDS"];

            try
            {
                string         max   = sysFuncs.GetNewMaxID("TaxType", "TaxID", 2, "COMON");
                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode",    SqlDbType.Char, 5),     //0
                    new SqlParameter("@TaxID",         SqlDbType.Char, 2),     //1
                    new SqlParameter("@TaxHead",       SqlDbType.VarChar, 50), //2
                    new SqlParameter("@TaxPer",        SqlDbType.Decimal),     //3
                    new SqlParameter("@Active",        SqlDbType.Char, 1),     //4
                    new SqlParameter("@Type",          SqlDbType.VarChar, 50), //5
                    new SqlParameter("@TaxApplicable", SqlDbType.VarChar, 20), //6
                    new SqlParameter("@AccCode",       SqlDbType.Char, 16),    //7
                    new SqlParameter("@UpdUser",       SqlDbType.VarChar, 50), //8
                    new SqlParameter("@UpdDate",       SqlDbType.DateTime),    //9
                    new SqlParameter("@UpdTime",       SqlDbType.DateTime),    //10
                    new SqlParameter("@UpdTerm",       SqlDbType.VarChar, 50), // 11
                };
                string activeCheck = "";
                if (CheckId.Checked)
                {
                    activeCheck = "Y";
                }
                else
                {
                    activeCheck = "N";
                }


                //  txtAccCode.Text = textAccCode;

                param[0].Value  = "COMON";
                param[1].Value  = max;
                param[2].Value  = txtTaxHead.Text;
                param[3].Value  = SysFunctions.CustomCDBL(txtTaxPercent.Text);
                param[4].Value  = activeCheck;
                param[5].Value  = ddlType.Text;
                param[6].Value  = ddlTaxApplicable.Text;
                param[7].Value  = txtAccCode.Text;
                param[8].Value  = Session["UserName"].ToString();
                param[9].Value  = sysFunc.SaveDate(DateTime.Now.ToString("dd-MM-yyyy"));
                param[10].Value = DateTime.Now;
                param[11].Value = "1";


                if (sysFunc.ExecuteSP_NonQuery("SP_Insert_TaxType", param))
                {
                    sysFunc.ClearTextBoxes(Page);
                    createGrid();
                    sysFuncs.UserMsg(lblMessage, Color.Green, "Record " + max + " Insert Sucessfully", txtTaxId);
                }
                else
                {
                    sysFuncs.UserMsg(lblMessage, Color.Green, "Data Not Inserted", txtTaxId);
                }
            }
            catch (Exception ex)
            {
                sysFunc.UserMsg(lblMessage, System.Drawing.Color.Red, ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["UserName"] == null)
            {
                Response.Redirect("~/Main/login.aspx");
            }
            rpt = new ReportDocument();
            String StrReportID, Type;

            Type        = Request.QueryString["Type"];
            StrReportID = Request.QueryString["ReportID"];
            if (StrReportID == "PaymentReceiptReport")
            {
                rpt.Load(Server.MapPath("rptPaymentReceiptPrint.rpt"));

                strCriteria = "{PaymentReceiptMaster.ReceiptNo}='" + Request.QueryString["ReceiptNo"] + "' " +
                              "AND {PaymentReceiptMaster.DealerCode}='" + Session["DealerCode"].ToString() + "' " +
                              "AND {PaymentReceiptMaster.DelFlag} = 'N' ";

                //rpt.RecordSelectionFormula = strCriteria;

                rpt.DataDefinition.FormulaFields["DealerDesc"].Text    = "'" + Session["DealerDesc"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'";

                rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Payment Receipt'";
                rpt.DataDefinition.FormulaFields["Terminal"].Text    = "'" + Environment.MachineName + "'";
                rpt.DataDefinition.FormulaFields["UserId"].Text      = "'" + Session["UserName"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["SalesTaxNo"].Text  = "'" + Session["DealerSaleTaxNo"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["NTN"].Text         = "'" + Session["DealerNTN"].ToString() + "'";
                //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + grl.GetStringValuesAgainstCodes("CusCode", SessionInformation.LoginID, "CellNo", "Customer") + "'";


                // CrystalReportViewer1.ReportSource = rpt;
            }
            if (StrReportID == "CustomerEstimate")
            {
                //ReportDocument RD;
                //string strCriteria, rptTitle;
                //DateTime FromDate, ToDate;
                //SqlDataReader rder;
                //CustEstimateCode

                SysFunctions   myFunc = new SysFunctions();
                Data.DSReports DsRpt  = new Data.DSReports();
                //DataSet1 dsRpt1 = new DataSet1();
                SqlDataReader rder = null;
                rpt = new ReportDocument();
                string         CCon  = CConnection.GetConnectionString();
                DataSet        ds    = new DataSet();
                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode", SqlDbType.Char),           //0
                    new SqlParameter("@CustomerEstimateCode", SqlDbType.Char), //1
                };
                param[0].Value           = Session["DealerCode"].ToString();
                param[1].Value           = Request.QueryString["CustEstimateCode"].ToString();
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateMaster_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateMaster_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateDetail_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateDetail_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateDetailSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateDetailSup_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateLubricates_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateLubricates_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateLubricatesSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateLubricatesSup_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateParts_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimateParts_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimatePartsSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'");
                DsRpt.sp_CustomerEstimatePartsSup_Print.Load(ds.CreateDataReader());
                DsRpt.EnforceConstraints = false;
                myFunc.ExecuteSP("sp_CustomerEstimateBoutParts_Print", param, ref rder);
                DsRpt.sp_CustomerEstimateBoutParts_Print.Load(rder);
                DsRpt.EnforceConstraints = false;
                myFunc.ExecuteSP("sp_EstimateSubletDetail_Print", param, ref rder);
                DsRpt.sp_JobCardSubletDetail_Print.Load(rder);

                rpt.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptCustomerEstimatePrint.rpt"));

                rpt.DataDefinition.FormulaFields["DealerName"].Text    = "'" + Session["DealerDesc"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["DealerPhone"].Text   = "'" + Session["DealerPhone"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["DealerEmail"].Text   = "'" + Session["DealerEmail"].ToString() + "'";
                if (Type == "Insurance")
                {
                    rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Insurance Estimate'";
                }
                else
                {
                    rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Customer Estimate'";
                }

                rpt.DataDefinition.FormulaFields["Terminal"].Text   = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["UserId"].Text     = "'" + Session["UserName"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["NTN"].Text        = "'N.T.N # " + Session["DealerNTN"].ToString() + "'";
                rpt.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No.  " + Session["DealerSaleTaxNo"].ToString() + " '";
                //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'";
                rpt.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'";
                rpt.Database.Tables[0].SetDataSource(DsRpt);
                //CrystalReportViewer1.ReportSource = rpt;
                //  rpt.SetDataSource(DsRpt.sp_CustomerEstimateMaster_Print.DataSet);

                Session["RDService"] = rpt;
            }
            else
            {
                rpt = (ReportDocument)Session["RD"];
            }

            //var connectionInfo = new ConnectionInfo();
            //connectionInfo.ServerName = "localhost";
            //connectionInfo.DatabaseName = "BMS";
            //connectionInfo.Password = "******";
            //connectionInfo.UserID = "sa";
            //connectionInfo.Type = ConnectionInfoType.SQL;
            //connectionInfo.IntegratedSecurity = false;

            //for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
            //{
            //    CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
            //}
            //if (Environment.MachineName == "AZHARDELL")
            //{
            //    rpt.SetDatabaseLogon("sa", "100372", "localhost", "BMS");
            //}
            //else
            //{
            //    rpt.SetDatabaseLogon("sa", "tiger", "akramali-pc", "BMS");
            //}
            string FilePath = Server.MapPath("~") + "\\Download\\";
            string FileName = "Report.pdf";
            string File     = FilePath + FileName;

            PdfDocument outputDocument = new PdfDocument();
            Stream      stream         = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);
            DirectoryInfo info = new DirectoryInfo(FilePath);

            if (!info.Exists)
            {
                info.Create();
            }

            string path = Path.Combine(FilePath, FileName);

            using (FileStream outputFileStream = new FileStream(path, FileMode.Create))
            {
                stream.CopyTo(outputFileStream);
            }
            stream.Dispose(); stream.Close();
            rpt.Dispose(); rpt.Close();
            Session["RDService"] = rpt;
            string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"1000px\" height=\"800px\">";

            embed       += "If you are unable to view file, you can download from <a href = \"{0}\">here</a>";
            embed       += " or download <a target = \"_blank\" href = \"http://get.adobe.com/reader/\">Adobe PDF Reader</a> to view the file.";
            embed       += "</object>";
            ltEmbed.Text = string.Format(embed, ResolveUrl("~/Download/Report.pdf"));

            //CrystalReportViewer1.ReportSource = rpt;
            //CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
        }
Esempio n. 8
0
        //protected void ChkBox_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (ChkBox.Checked)
        //    {
        //        foreach (GridViewRow gvr in Grdbillings.Rows)
        //        {
        //            TotalAmount = TotalAmount + Convert.ToDecimal(gvr.Cells[5].Text.Trim());
        //            CheckBox Chk = (CheckBox)gvr.Cells[0].FindControl("ChkBox");
        //            Chk.Checked = true;
        //        }
        //        txtTotalAmount.Text = TotalAmount.ToString();
        //        CalculatePSTPercentage();
        //    }
        //    else
        //    {
        //        foreach (GridViewRow gvr in Grdbillings.Rows)
        //        {
        //            CheckBox Chk = (CheckBox)gvr.Cells[0].FindControl("ChkBox");
        //            Chk.Checked = false;
        //            txtTotalAmount.Text = "0.00";
        //            //txtPstAmt.Text = "0.00";
        //        }
        //    }

        //}
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!sec.UserRight("2583", "002"))
            {
                Response.Redirect("~/Test.aspx");
            }
            try
            {
                int grd = Grdbillings.Rows.Count;
                if (grd > 0)
                {
                    //Auto Generated Code//
                    DateTime dt      = DateTime.Now;
                    string   strYear = dt.Year.ToString();
                    string   BillNo;
                    if (ddlBillingNo.SelectedValue.Trim() == "0")
                    {
                        BillNo = ObjGenral.AutoGen("JENBillMaster", "JENBillNo", DateTime.Now.ToString("dd-MM-yyyy"));
                    }
                    else
                    {
                        BillNo = ddlBillingNo.SelectedValue.Trim();
                    }
                    //Auto Generated Code//
                    string Remarks = txtRemarks.Text.Trim().ToString();
                    float  BillRecAmount = 0;
                    string DelFlag = "N", PostFlag = "N";
                    string UpdUser = Session["UserName"].ToString();

                    //FFI PDI Master Insert here
                    SqlParameter[] param =
                    {
                        new SqlParameter("@DealerCode",      SqlDbType.Char, 5),      //0
                        new SqlParameter("@FPBillNo",        SqlDbType.Char, 8),      //1
                        new SqlParameter("@BillDate",        SqlDbType.DateTime),     //2
                        new SqlParameter("@Remarks",         SqlDbType.VarChar, 100), //3
                        new SqlParameter("@BillQty",         SqlDbType.Int),          //4
                        new SqlParameter("@BillAmount",      SqlDbType.Float, 15),    //5
                        new SqlParameter("@BillRecAmount",   SqlDbType.Float, 15),    //6
                        new SqlParameter("@DelFlag",         SqlDbType.Char, 1),      //7
                        new SqlParameter("@PostFlag",        SqlDbType.Char, 1),      //8
                        new SqlParameter("@UpdUser",         SqlDbType.VarChar, 5),   //9
                        //new SqlParameter("@UpdDate",SqlDbType.DateTime),//10
                        //new SqlParameter("@UpdTime",SqlDbType.DateTime),//11
                        new SqlParameter("@UpdTerm",         SqlDbType.VarChar, 50), //12
                        new SqlParameter("@TransferStatus",  SqlDbType.Char, 1),     //13
                        new SqlParameter("@VoucherNo",       SqlDbType.VarChar, 50), //14
                        new SqlParameter("@VoucherFlag",     SqlDbType.Char, 1),     //15
                        new SqlParameter("@SoftwareVersion", SqlDbType.VarChar, 25), //16
                        new SqlParameter("@BillType",        SqlDbType.VarChar, 5),  //17
                        new SqlParameter("@VehType",         SqlDbType.Char, 3),     //17
                        new SqlParameter("@CreditNo",        SqlDbType.VarChar, 50), //17
                        new SqlParameter("@GSTAmount",       SqlDbType.Decimal, 50), //17
                        new SqlParameter("@SSTAmount",       SqlDbType.Decimal, 50), //17
                        //new SqlParameter("@SSTAge",SqlDbType.Decimal,18),//18
                        //new SqlParameter("@SSTAmount",SqlDbType.Decimal,18),//19
                    };
                    param[0].Value = Session["DealerCode"].ToString();
                    param[1].Value = BillNo;
                    param[2].Value = ObjGenral.SaveDate(txtBillDate.Text);
                    //param[2].Value = txtBillDate.Text;
                    param[3].Value = Remarks.ToUpper();
                    param[4].Value = Grdbillings.Rows.Count;
                    param[5].Value = txtTotalAmount.Text.Trim().ToString();
                    param[6].Value = BillRecAmount;
                    param[7].Value = DelFlag;
                    param[8].Value = PostFlag;
                    param[9].Value = Session["UserName"].ToString();
                    //param[10].Value = ObjGenral.SaveDate(DateTime.Now.ToString());
                    //param[11].Value = ObjGenral.SaveTime(DateTime.Now.ToString());
                    param[10].Value = GlobalVar.mUserIPAddress;
                    param[11].Value = "C";
                    param[12].Value = null;
                    param[13].Value = null;
                    param[14].Value = null;
                    param[15].Value = ddlTypes.SelectedValue.ToString();
                    param[16].Value = txtCreditNo.Text;
                    param[17].Value = txtGSTAmt.Text.Trim();
                    param[18].Value = txtLabPST.Text.Trim();
                    if (ObjTrans.BeginTransaction(ref Trans) == true)
                    {
                        if (ObjGenral.ExecuteSP_NonQuery("sp_Service_JENBillMaster_Insert", param, Trans))
                        {
                            lblLastBillNo.Text = "Last Code Generated : " + " " + BillNo;
                        }
                    }


                    else
                    {
                        lblMessage.Text = "Error";
                    }

                    //FFI PDI Master Insert here
                    //Insert Detail Data Here
                    foreach (GridViewRow gvr in Grdbillings.Rows)
                    {
                        string DealerCode   = Session["DealerCode"].ToString();
                        string PPRCode      = gvr.Cells[1].Text.Trim().ToString();
                        string BillNoDetail = BillNo;
                        // string Billtype = ddlTypes.SelectedValue.ToString();
                        string BillAmount = gvr.Cells[5].Text.Trim().ToString();

                        CheckBox Chk = (CheckBox)gvr.Cells[0].FindControl("ChkBox");

                        SqlParameter[] param1 =
                        {
                            new SqlParameter("@DealerCode",     SqlDbType.Char, 5),     //0
                            new SqlParameter("@JENBillNo",      SqlDbType.Char, 8),     //1
                            new SqlParameter("@PPRCode",        SqlDbType.Char, 8),     //2
                            new SqlParameter("@PPRDate",        SqlDbType.DateTime),    //3
                            new SqlParameter("@ChassisNo",      SqlDbType.VarChar, 15), //4
                            new SqlParameter("@Parts",          SqlDbType.Float),       //5
                            new SqlParameter("@Sublet",         SqlDbType.Float),       //6
                            new SqlParameter("@Labor",          SqlDbType.Float),       //7
                            new SqlParameter("@TotalAmount",    SqlDbType.Float),       //8
                            new SqlParameter("@GSTAmount",      SqlDbType.Float),       //9
                            new SqlParameter("@PSTLaborAmount", SqlDbType.Float),       //10
                            new SqlParameter("@PSTSublet",      SqlDbType.Float),       //11
                            new SqlParameter("@HandlingAmount", SqlDbType.Float),       //12
                        };

                        param1[0].Value  = Session["DealerCode"].ToString();
                        param1[1].Value  = BillNoDetail;
                        param1[2].Value  = PPRCode;
                        param1[3].Value  = sysFunc.SaveDate(gvr.Cells[2].Text.Trim().ToString());
                        param1[4].Value  = gvr.Cells[4].Text.Trim().ToString();
                        param1[5].Value  = SysFunctions.CustomCDBL(gvr.Cells[12].Text);
                        param1[6].Value  = SysFunctions.CustomCDBL(gvr.Cells[13].Text);
                        param1[7].Value  = SysFunctions.CustomCDBL(gvr.Cells[14].Text);
                        param1[8].Value  = SysFunctions.CustomCDBL(gvr.Cells[15].Text);
                        param1[9].Value  = SysFunctions.CustomCDBL(gvr.Cells[7].Text);
                        param1[10].Value = SysFunctions.CustomCDBL(gvr.Cells[9].Text);
                        param1[11].Value = SysFunctions.CustomCDBL(gvr.Cells[11].Text);
                        param1[12].Value = SysFunctions.CustomCDBL(gvr.Cells[6].Text);
                        // param1[3].Value = Billtype;

                        if (Chk.Checked == true)
                        {
                            if (ObjGenral.ExecuteSP_NonQuery("sp_Service_JENBillDetail_Insert", param1, Trans))
                            {
                                lblMessage.Text = "Record Has been Inserted Sucessfully !!!";
                                ClearAll();
                            }
                            // ObjGenral.ExecuteSP_NonQuery("sp_Service_JENBillDetail_Insert", param1,Trans);
                        }

                        //Insert Detail Data Here
                    }
                }
                else
                {
                    string script = "alert(\"User should select some Bills !!!\");";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ServerControlScript", script, true);
                }
            }
            catch (Exception ex)
            {
                ObjTrans.RollBackTransaction(ref Trans);
                lblMessage.Text = ex.Message;
            }
            ObjTrans.CommittTransaction(ref Trans);
        }
Esempio n. 9
0
        //protected void ddlFromCode_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    ddlToCode.SelectedValue = ddlFromCode.SelectedValue;
        //}

        protected void btnPrint_Click(object sender, EventArgs e)
        {
            if (!sec.UserRight("2574", "006"))
            {
                Response.Redirect("~/Test.aspx");
            }
            if (txtFromItemCode.Text == "")
            {
                //ObjGenral.UserMsg(lblMsg, Color.Red, "Please Select From Code ");
                //ddlFromCode.Focus();
                return;
            }
            if (txtToItemCode.Text == "")
            {
                //ObjGenral.UserMsg(lblMsg, Color.Red, "Please Select To Code ");
                //ddlToCode.Focus();
                return;
            }

            ReportDocument RD;
            ReportDocument crReportDocument;
            ReportDocument rpt;
            SqlDataReader  rder;
            string         ReportID = "";

            DXBMS.Data.DataSet1 dsrpt;
            SysFunctions        ObjSysFunc = new SysFunctions();


            string FromDate = txtFromDate.Text.Substring(6, 4) + "/" + txtFromDate.Text.Substring(3, 2) + "/" + txtFromDate.Text.Substring(0, 2);
            string ToDate   = txtToDate.Text.Substring(6, 4) + "/" + txtToDate.Text.Substring(3, 2) + "/" + txtToDate.Text.Substring(0, 2);
            string RptName  = "PartItemLedger";


            RD = new ReportDocument();

            string StrToDateFrom = "", StrDateTo = "";

            RD    = new ReportDocument();
            dsrpt = new DXBMS.Data.DataSet1();
            // PartItemLedger.sp_ItemStockLedger_select.Load(ds.CreateDataReader());
            DataSet ds = new DataSet();

            //DataSet ds1 = new DataSet();
            StrToDateFrom = FromDate;
            StrDateTo     = ToDate;
            SqlParameter[] param =
            {
                new SqlParameter("@DealerCode",   SqlDbType.Char, 5),            //0
                new SqlParameter("@FromPartCode", SqlDbType.VarChar, 50),        //0
                new SqlParameter("@ToPartCode",   SqlDbType.VarChar, 50),        //0
                new SqlParameter("@OpeningDate",  SqlDbType.VarChar, 10),        //0
                new SqlParameter("@ToDate",       SqlDbType.VarChar, 10),        //0
            };
            param[0].Value = Session["DealerCode"].ToString();
            param[1].Value = txtFromItemCode.Text;
            param[2].Value = txtToItemCode.Text;
            param[3].Value = Convert.ToDateTime(StrToDateFrom).ToString("yyyy-MM-dd");
            param[4].Value = Convert.ToDateTime(StrDateTo).ToString("yyyy-MM-dd");
            ObjSysFunc.ExecuteSP_NonQuery("sp_PartItemLedger", param);
            ds = SqlHelper.ExecuteDataset(CConnection.GetConnectionString(), CommandType.Text, "sp_tempItemStockLedger_Select '" + Session["DealerCode"].ToString() + "'");
            dsrpt.sp_tempItemStockLedger_Select.Load(ds.CreateDataReader());

            //RD.Load(base.Server.MapPath("rptItemStockLedger.rpt"));
            RD.Load(Server.MapPath("~/Modules/SpareParts/SpareReports/rptItemStockLedger.rpt"));

            //RD.Load(Server.MapPath("~/Modules/Reports/rptStockLedgerNew.rpt"));

            // //RD.Load(base.Server.MapPath("rptLedger.rpt"));
            RD.DataDefinition.FormulaFields["DealerName"].Text    = "'" + Session["DealerDesc"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerPhone"].Text   = "'" + Session["DealerPhone"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerEmail"].Text   = "'" + Session["DealerEmail"].ToString() + "'";
            RD.DataDefinition.FormulaFields["UserID"].Text        = "'" + Session["UserName"].ToString() + "'";
            RD.DataDefinition.FormulaFields["FromCode"].Text      = "\"" + Convert.ToDateTime(FromDate).ToString("dd/MM/yyyy") + "\"";
            RD.DataDefinition.FormulaFields["ToCode"].Text        = "\"" + Convert.ToDateTime(ToDate).ToString("dd/MM/yyyy") + "\"";
            RD.DataDefinition.FormulaFields["NTN"].Text           = "'N.T.N # " + Session["DealerNTN"].ToString() + "'";
            RD.DataDefinition.FormulaFields["SalesTaxNo"].Text    = "'Sales Tax No.  " + Session["DealerSaleTaxNo"].ToString() + " '";
            //RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'";
            RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "ITEM STOCK LEDGER REPORT" + "\"";
            RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'";
            //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'";
            RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'";
            //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'";
            //RD.SetDataSource(dsrpt.sp_tempItemStockLedger_Select.DataSet);
            RD.SetDataSource(dsrpt);

            string FilePath = Server.MapPath("~") + "\\Download\\";
            string FileName = "Report.pdf";
            string File     = FilePath + FileName;

            PdfDocument outputDocument = new PdfDocument();
            Stream      stream         = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);
            DirectoryInfo info = new DirectoryInfo(FilePath);

            if (!info.Exists)
            {
                info.Create();
            }

            string path = Path.Combine(FilePath, FileName);

            using (FileStream outputFileStream = new FileStream(path, FileMode.Create))
            {
                stream.CopyTo(outputFileStream);
            }
            stream.Dispose(); stream.Close();
            string URL = "../../../../Download/PrintReport.aspx";

            string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');";

            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
            //string FilePath = Server.MapPath("~") + "\\Download\\";
            //string FileName = "PartItemLedger" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf";
            //string File = FilePath + FileName;
            ////crReportDocument.SetDatabaseLogon("SDMS", "sdms161", "192.168.1.47", "SDMS");

            //// ConnectionInfo conninfo = new ConnectionInfo();
            //Session["RD"] = RD;
            ////RD.ExportToDisk(ExportFormatType.PortableDocFormat, File);
            ////crReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, File);

            //string URL;
            //URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName;


            //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');";

            //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
        }
Esempio n. 10
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            if (!sec.UserRight("2590", "006"))
            {
                Response.Redirect("~/Test.aspx");
            }
            ReportDocument rpt, crReportDocument, RD;
            PdfDocument    outputDocument = new PdfDocument();
            string         strCriteria, rptTitle;
            DateTime       FromDate, ToDate;
            SqlDataReader  rder;
            SysFunctions   myFunc = new SysFunctions();

            Data.DSReports DSReports = new Data.DSReports();


            RD = new ReportDocument();
            string CCon = CConnection.GetConnectionString();
            // PartItemLedger.sp_ItemStockLedger_select.Load(ds.CreateDataReader());
            DataSet ds = new DataSet();

            //if (txtTransCode.Text.Trim() != "")
            //{
            //    ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_GatePassMaster_Print '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'");
            //}
            //else
            //{
            //    ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_W2_GatePass_VehicleDetail_Select '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'");
            //}


            // QRCodeEncoder encoder = new QRCodeEncoder();

            // Bitmap bi = encoder.Encode(ds.Tables[0].Rows[0]["DealerCode"].ToString() + "" + ds.Tables[0].Rows[0]["JobCardCode"].ToString());

            // bi.SetPixel(10, 10, Color.Red);

            //  bi.Save(Server.MapPath("~/Images/QrCode.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg);
            ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "_sp_GatePassTempForm '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'");
            DSReports.EnforceConstraints = false;
            DSReports._sp_GatePassTempForm.Load(ds.CreateDataReader());



            string FileRptPath = Server.MapPath("~/Modules/Service/ServiceReports/");


            RD.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptGatePassForm.rpt"));



            RD.DataDefinition.FormulaFields["DealerName"].Text    = "'" + Session["DealerDesc"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerPhone"].Text   = "'" + Session["DealerPhone"].ToString() + "'";
            RD.DataDefinition.FormulaFields["DealerEmail"].Text   = "'" + Session["DealerEmail"].ToString() + "'";
            RD.DataDefinition.FormulaFields["ReportTitle"].Text   = "'Gate Pass'";
            RD.DataDefinition.FormulaFields["Terminal"].Text      = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'";
            RD.DataDefinition.FormulaFields["UserId"].Text        = "'" + Session["UserName"].ToString() + "'";
            RD.DataDefinition.FormulaFields["NTN"].Text           = "'N.T.N # " + Session["DealerNTN"].ToString() + "'";
            RD.DataDefinition.FormulaFields["SalesTaxNo"].Text    = "'Sales Tax No.  " + Session["DealerSaleTaxNo"].ToString() + " '";
            //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'";
            RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'";
            //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'";
            RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'";

            RD.DataDefinition.FormulaFields["QRCode"].Text = "'" + Server.MapPath("~") + "/Images/QrCode.jpg'";

            //DataTable dt = new DataTable();

            //string sql = "Select Logo from Dealer where DealerCode = '" + Session["DealerCode"].ToString() + "'";

            //dt = myFunc.GetData(sql);

            //RD.DataDefinition.FormulaFields["Logo"].Text = "'"+dt.Rows[0]["Logo"].ToString()+"'";
            //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'";


            // CrystalReportViewer1.ReportSource = rpt;
            RD.SetDataSource(DSReports.sp_JobCardMaster_Print.DataSet);
            string FilePath = Server.MapPath("~") + "\\Download\\";
            string FileName = "Report.pdf";
            string File     = FilePath + FileName;


            Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);
            DirectoryInfo info = new DirectoryInfo(FilePath);

            if (!info.Exists)
            {
                info.Create();
            }

            string path = Path.Combine(FilePath, FileName);

            using (FileStream outputFileStream = new FileStream(path, FileMode.Create))
            {
                stream.CopyTo(outputFileStream);
            }
            stream.Dispose(); stream.Close();
            string URL = "../../../Download/PrintReport.aspx";

            string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');";

            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
        }