Пример #1
0
    public static string loginUser(string LoginID, string password, string Branch)
    {
        password = Encryption.Encrypt(password);
        SqlConnection Conn     = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  UserID   = new SqlParameter("@UserID", LoginID);
        SqlParameter  Password = new SqlParameter("@Password", password);
        SqlParameter  BranchID = new SqlParameter("@BranchID", Branch);
        DataSet       ds       = AACommon.ReturnDatasetBySP("USER_GET_BY_LOGINID", Conn, UserID, Password, BranchID);


        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                GetRegionClass dbdc = new GetRegionClass();

                dbdc.ID          = ds.Tables[0].Rows[i]["UserID"].ToString();
                dbdc.Name        = ds.Tables[0].Rows[i]["UserName"].ToString();
                dbdc.Login       = ds.Tables[0].Rows[i]["loginID"].ToString();
                dbdc.Picture     = ds.Tables[0].Rows[i]["Picture"].ToString();
                dbdc.Manager     = ds.Tables[0].Rows[i]["ManagerID"].ToString();
                dbdc.UTID        = ds.Tables[0].Rows[i]["UTID"].ToString();
                dbdc.Designation = ds.Tables[0].Rows[i]["UTID"].ToString();
                dbdc.BranchID    = ds.Tables[0].Rows[i]["BranchID"].ToString();
                dbdc.UTDesc      = ds.Tables[0].Rows[i]["UTDesc"].ToString();
                dbdc.BranchName  = ds.Tables[0].Rows[i]["BranchName"].ToString();
                RegionList.Insert(i, dbdc);
            }
        }

        JavaScriptSerializer jser = new JavaScriptSerializer();


        return(jser.Serialize(RegionList));
    }
    public static string LoadLISTSearch(string UserID, string PaymentType)
    {
        string htm = "";

        htm = htm + "<table id='data-table' class='table table-striped' >";
        htm = htm + "<thead><tr>";
        htm = htm + "<th>TR ID</th>";
        htm = htm + "<th>TR Date</th>";
        htm = htm + "<th>Party</th>";
        htm = htm + "<th>Description / Narration</th>";
        htm = htm + "<th></th>";
        htm = htm + "</tr>";
        htm = htm + "</thead>";
        htm = htm + "<tbody>";
        SqlConnection Con  = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  SPID = new SqlParameter("@WRIDMaster", PaymentType);
        DataSet       ds   = AACommon.ReturnDatasetBySP("TR_LIST_Search_Master_2", Con, SPID);
        DataTable     dt   = new DataTable();

        if (ds.Tables.Count > 0)
        {
            dt = ds.Tables[0];
        }

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            htm = htm + "<tr >";
            htm = htm + "<td>" + dt.Rows[i]["WRIDMaster"].ToString() + "</td>";
            htm = htm + "<td>" + dt.Rows[i]["WRDateMaster"].ToString() + "</td>";
            htm = htm + "<td>" + dt.Rows[i]["ShopName"].ToString() + "</td>";
            htm = htm + "<td>" + dt.Rows[i]["CustomerName"].ToString() + "</td>";
            htm = htm + "<td><a href='../REPORTS/TR_IN_HIS_2.aspx?ID=" + dt.Rows[i]["WRIDMaster"].ToString() + "&Type=Detail' target='_blank'>View Report</a></td>";
            htm = htm + "</tr>";
        }
        htm = htm + "</tbody>";
        htm = htm + "</table>";
        return(htm);
    }
Пример #3
0
    public static string InsertRegion(string RegionName, string UserID, string BranchID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  UTDesc     = new SqlParameter("@UTDesc", RegionName);
        SqlParameter  CREATEBY   = new SqlParameter("@CREATEBY", UserID);
        SqlParameter  Branch     = new SqlParameter("@BranchID", BranchID);

        msg = AACommon.Execute("USERTYPE_INSERT", Conn, UTDesc, CREATEBY, Branch);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #4
0
    public static string UpdateRegion(string AreaID, string AreaTitle, string TalukaID)
    {
        string        retMessage   = string.Empty;
        string        msg          = "";
        SqlConnection Conn         = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  UnitID_P     = new SqlParameter("@AreaID", AreaID);
        SqlParameter  UnitTitle_P  = new SqlParameter("@AreaTitle", AreaTitle);
        SqlParameter  UnitTypeID_P = new SqlParameter("@TalukaID", TalukaID);

        msg = AACommon.Execute("SP_Area_Update", Conn, UnitID_P, UnitTitle_P, UnitTypeID_P);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #5
0
    public static string LoadLoginID(string LoginID, string BranchID)
    {
        string                retMessage = string.Empty;
        SqlConnection         Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter          loginID    = new SqlParameter("@loginID", LoginID);
        SqlParameter          Branch     = new SqlParameter("@BranchID", BranchID);
        DataSet               ds         = AACommon.ReturnDatasetBySP("USER_GET_BY_LOGIN", Conn, loginID, Branch);
        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            retMessage = "false";
        }
        else
        {
            retMessage = "true";
        }



        return(retMessage);
    }
Пример #6
0
    public static string LoadRegionName(string RegionName, string BranchID)
    {
        string                retMessage = string.Empty;
        SqlConnection         Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter          UTDesc     = new SqlParameter("@UTDesc", RegionName);
        SqlParameter          Branch     = new SqlParameter("@BranchID", BranchID);
        DataSet               ds         = AACommon.ReturnDatasetBySP("USERTYPE_GET_BY_NAME", Conn, UTDesc, Branch);
        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            retMessage = "false";
        }
        else
        {
            retMessage = "true";
        }



        return(retMessage);
    }
Пример #7
0
    public static string LoadRegionCombo2()
    {
        SqlConnection             Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        DataSet                   ds         = AACommon.ReturnDatasetBySPWithoutParameter("ITEM_Packing_Get", Conn);
        List <GetRegionClasssPCK> RegionList = new List <GetRegionClasssPCK>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                GetRegionClasssPCK dbdc = new GetRegionClasssPCK();

                dbdc.PackingTypeID   = ds.Tables[0].Rows[i][0].ToString();
                dbdc.PackingTypeDesc = ds.Tables[0].Rows[i][1].ToString();
                RegionList.Insert(i, dbdc);
            }
        }

        JavaScriptSerializer jser = new JavaScriptSerializer();

        return(jser.Serialize(RegionList));
    }
Пример #8
0
    public static string LoadUNITS(string itmID, string UntTyp)
    {
        string        vUNT       = "";
        SqlConnection Con        = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  UnitTypeID = new SqlParameter("@UnitTypeID", UntTyp);
        DataSet       ds         = AACommon.ReturnDatasetBySP("ITM_UNITS_GET", Con, UnitTypeID);

        vUNT = "<span id='spnUNT" + itmID + "' style='display:none;'>";
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            if (i == 0)
            {
                vUNT = vUNT + ds.Tables[0].Rows[i]["UnitID"].ToString() + "^" + ds.Tables[0].Rows[i]["DisplayName"].ToString();
            }
            else
            {
                vUNT = vUNT + "~" + ds.Tables[0].Rows[i]["UnitID"].ToString() + "^" + ds.Tables[0].Rows[i]["DisplayName"].ToString();
            }
        }
        ds.Dispose();
        vUNT = vUNT + "</span>";
        return(vUNT);
    }
Пример #9
0
    public void loadDate()
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConACC"].ConnectionString);

        // System.Windows.Forms.MessageBox.Show(summary);
        try
        {
            DataTable dt = AACommon.LoadControl("DATE_FILTER", con, null);


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                txtFrom.Text = dt.Rows[i]["WeekStart"].ToString();
                txtTo.Text   = dt.Rows[i]["WeekEnd"].ToString();
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);

            //return null;
        }
    }
Пример #10
0
    public static string LoadRegion()
    {
        SqlConnection            Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        DataSet                  ds         = AACommon.ReturnDatasetBySPWithoutParameter("ITM_ITEM_GET", Conn);
        List <GetRegionClassLCK> RegionList = new List <GetRegionClassLCK>();

        RegionList.Clear();

        //if (ds.Tables[0].Rows.Count > 0)
        //{
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            GetRegionClassLCK dbdc = new GetRegionClassLCK();

            dbdc.ITEMID         = ds.Tables[0].Rows[i]["ITEMID"].ToString();
            dbdc.ITEMName       = ds.Tables[0].Rows[i]["ITEMName"].ToString();
            dbdc.ItemCode       = ds.Tables[0].Rows[i]["ItemCode"].ToString();
            dbdc.BarCode        = ds.Tables[0].Rows[i]["BarCode"].ToString();
            dbdc.Discription    = ds.Tables[0].Rows[i]["Discription"].ToString();
            dbdc.UnitTypeID     = ds.Tables[0].Rows[i]["UnitTypeID"].ToString();
            dbdc.DistPercentage = ds.Tables[0].Rows[i]["DistPercentage"].ToString();
            dbdc.TradePrice     = ds.Tables[0].Rows[i]["TradePrice"].ToString();
            dbdc.RetailPrice    = ds.Tables[0].Rows[i]["RetailPrice"].ToString();
            dbdc.PackingTypeID  = ds.Tables[0].Rows[i]["PackingTypeID"].ToString();
            dbdc.Wt             = ds.Tables[0].Rows[i]["Wt"].ToString();

            RegionList.Insert(i, dbdc);
        }

        //}


        JavaScriptSerializer jser = new JavaScriptSerializer();


        return(jser.Serialize(RegionList));
    }
Пример #11
0
    public static string LoadLIST(string UserID, string PaymentType, string BranchID)
    {
        string htm = "";

        htm = htm + "<table id='data-table' class='table table-striped' >";
        htm = htm + "<thead><tr>";
        htm = htm + "<th>Voucher ID</th>";
        htm = htm + "<th>Voucher Date</th>";
        htm = htm + "<th>Amount</th>";
        htm = htm + "<th></th>";
        htm = htm + "</tr>";
        htm = htm + "</thead>";
        htm = htm + "<tbody>";
        SqlConnection Con    = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  Type   = new SqlParameter("@Type", PaymentType);
        SqlParameter  Branch = new SqlParameter("@BranchID", BranchID);
        DataSet       ds     = AACommon.ReturnDatasetBySP("Voucher_LIST", Con, Type, Branch);
        DataTable     dt     = new DataTable();

        if (ds.Tables.Count > 0)
        {
            dt = ds.Tables[0];
        }

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            htm = htm + "<tr >";
            htm = htm + "<td>" + dt.Rows[i]["TaskID"].ToString() + "</td>";
            htm = htm + "<td>" + dt.Rows[i]["Date"].ToString() + "</td>";
            htm = htm + "<td>" + dt.Rows[i]["AmountPKR"].ToString() + "</td>";
            htm = htm + "<td><a href='../REPORTS/Voucher_His.aspx?ID=" + dt.Rows[i]["TaskID"].ToString() + "&BID=" + BranchID + "' target='_blank'>Print</a></td>";
            htm = htm + "</tr>";
        }
        htm = htm + "</tbody>";
        htm = htm + "</table>";
        return(htm);
    }
Пример #12
0
    public static string DeleteRegion(string DistrictID, string UserID, string BranchID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  UTFID      = new SqlParameter("@UTFID", DistrictID);
        SqlParameter  MODIFYBY   = new SqlParameter("@MODIFYBY", UserID);
        SqlParameter  Branch     = new SqlParameter("@BranchID", BranchID);

        msg = AACommon.Execute("USERTYPE_FORM_DELETE", Conn, UTFID, MODIFYBY, Branch);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
        //}
    }
Пример #13
0
    public static string LoadRegion()
    {
        SqlConnection         Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        DataSet               ds         = AACommon.ReturnDatasetBySPWithoutParameter("Customer_Get", Conn);
        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                GetRegionClass dbdc = new GetRegionClass();

                dbdc.CustomerID    = ds.Tables[0].Rows[i]["CustomerID"].ToString();
                dbdc.CustomerTitle = ds.Tables[0].Rows[i]["CustomerTitle"].ToString();
                dbdc.CustomerCode  = ds.Tables[0].Rows[i]["CustomerCode"].ToString();
                dbdc.Phone         = ds.Tables[0].Rows[i]["Phone"].ToString();
                dbdc.Fax           = ds.Tables[0].Rows[i]["Fax"].ToString();
                dbdc.Email         = ds.Tables[0].Rows[i]["Email"].ToString();
                dbdc.AddressLine1  = ds.Tables[0].Rows[i]["AddressLine1"].ToString();
                dbdc.AddressLine2  = ds.Tables[0].Rows[i]["AddressLine2"].ToString();
                dbdc.NTN           = ds.Tables[0].Rows[i]["NTN"].ToString();
                dbdc.GST           = ds.Tables[0].Rows[i]["GST"].ToString();
                dbdc.SRB           = ds.Tables[0].Rows[i]["SRB"].ToString();
                dbdc.InvoiceDays   = ds.Tables[0].Rows[i]["InvoiceDays"].ToString();
                dbdc.AgingDays     = ds.Tables[0].Rows[i]["AgingDays"].ToString();
                dbdc.OpBal         = ds.Tables[0].Rows[i]["OpBal"].ToString();
                RegionList.Insert(i, dbdc);
            }
        }

        JavaScriptSerializer jser = new JavaScriptSerializer();


        return(jser.Serialize(RegionList));
    }
Пример #14
0
    public static string InsertRegion(string UnitType, string UserID, string BranchID)
    {
        string        retMessage = string.Empty;
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        string        ID         = AACommon.GetAlphaNumericIDSIX("Category", "CAT-", "CatID", Conn);
        SqlCommand    cmd        = new SqlCommand("insert into Category (CatID,CatTitle,CreateBy,BranchID) values ('" + ID + "','" + UnitType + "','" + UserID + "','" + BranchID + "')", Conn);

        Conn.Open();
        int a = cmd.ExecuteNonQuery();

        Conn.Close();


        if (a == 1)
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
    protected void LoadReportBrand(object sender, EventArgs e)
    {
        string Type = Request.QueryString["Type"].ToString();

        if (Type == "Stock-Summary")
        {
            string        rptName    = "StockWareHouseMaster.rpt";
            SqlConnection Con        = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  AccountsID = new SqlParameter("@BrandID", ddlBrand.SelectedValue);
            DataSet       ds         = AACommon.ReturnDatasetBySPForREPORT("STOCK_BALANCE_WH_MASTER_BRAND", "VW_STOCK_BALANCE_WH_MASTER", Con, AccountsID);
            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=VW_STOCK_BALANCE_WH_MASTER");
        }
        else
        if (Type == "Stock-Ledger")
        {
            string        rptName    = "StockLedgerWareHouseMaster.rpt";
            SqlConnection Con        = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  AccountsID = new SqlParameter("@BrandID", ddlBrand.SelectedValue);
            DataSet       ds         = AACommon.ReturnDatasetBySPForREPORT("STOCK_LEDGER_WH_Master_BRAND", "VW_STOCK_LEDGER_WH_Master", Con, AccountsID);
            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=VW_STOCK_LEDGER_WH_Master");
        }
    }
Пример #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string rqID    = Request.QueryString["ID"].ToString();
        string BID     = Request.QueryString["BID"].ToString();
        string T       = rqID.Substring(0, 3);
        string rptName = "";

        rptName = "Voucher_His.rpt";
        //if (T == "PVD")
        //{
        //    rptName = "Voucher_His.rpt";
        //}
        //else
        //{
        //    rptName = "Voucher_His_Credit.rpt";
        //}
        SqlConnection Con    = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  ReqID  = new SqlParameter("@TaskID", rqID);
        SqlParameter  Branch = new SqlParameter("@BranchID", BID);
        DataSet       ds     = AACommon.ReturnDatasetBySPForREPORT("VoucherPRINT", "VW_LEDGER", Con, ReqID, Branch);

        Session["RptDS"] = ds;
        Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=VW_LEDGER");
    }
Пример #17
0
    public static string LoadForm()
    {
        SqlConnection         Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        DataSet               ds         = AACommon.ReturnDatasetBySPWithoutParameter("FORM_GET_ALL", Conn);
        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                GetRegionClass dbdc = new GetRegionClass();

                dbdc.ID   = ds.Tables[0].Rows[i][0].ToString();
                dbdc.Name = ds.Tables[0].Rows[i][1].ToString();
                RegionList.Insert(i, dbdc);
            }
        }

        JavaScriptSerializer jser = new JavaScriptSerializer();


        return(jser.Serialize(RegionList));
    }
Пример #18
0
    public static string LoadRegionName(string utid, string form, string BranchID)
    {
        string                retMessage = string.Empty;
        SqlConnection         Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter          FormID     = new SqlParameter("@FormID", form);
        SqlParameter          UTID       = new SqlParameter("@UTID", utid);
        SqlParameter          Branch     = new SqlParameter("@BranchID", BranchID);
        DataSet               ds         = AACommon.ReturnDatasetBySP("FORM_TYPE_GET_BY_FORM_ID_USERTYPE_ID", Conn, FormID, UTID, Branch);
        List <GetRegionClass> RegionList = new List <GetRegionClass>();

        RegionList.Clear();
        if (ds.Tables[0].Rows.Count > 0)
        {
            retMessage = "false";
        }
        else
        {
            retMessage = "true";
        }



        return(retMessage);
    }
Пример #19
0
    public static string InsertRegion(string DistrictName, string pid, string path, string UserID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  FormTitle  = new SqlParameter("@FormTitle", DistrictName);
        SqlParameter  PID        = new SqlParameter("@PID", pid);
        SqlParameter  PATH       = new SqlParameter("@Path", path);
        SqlParameter  CREATEBY   = new SqlParameter("@CREATEBY", UserID);

        msg = AACommon.Execute("FORM_INSERT", Conn, FormTitle, PID, PATH, CREATEBY);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #20
0
    public void GetLedgerBalance()
    {
        DataSet ds = AACommon.ReturnDatasetBySP("AA_Get_Ledger_Current_Balance", Con, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string query = "";
                if (Convert.ToDouble(ds.Tables[0].Rows[i]["Balance"].ToString()) > 0)
                {
                    query = "update Accounts set OpDebit='" + ds.Tables[0].Rows[i]["Balance"].ToString() + "', OpCredit='0' where AccountsID='" + ds.Tables[0].Rows[i]["AccountsID"].ToString() + "'";
                }
                else
                {
                    query = "update Accounts set OpCredit='" + ds.Tables[0].Rows[i]["Balance"].ToString() + "', OpDebit='0' where AccountsID='" + ds.Tables[0].Rows[i]["AccountsID"].ToString() + "'";
                }
                SqlCommand cmd = new SqlCommand(query, Con);
                Con.Open();
                cmd.ExecuteNonQuery();
                Con.Close();
            }
        }
    }
Пример #21
0
    public static string DeleteRegion(string UnitTypeID, string UserID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);


        SqlParameter UnitTypeID_P = new SqlParameter("@UnitTypeID", UnitTypeID);
        SqlParameter DeleteBy_P   = new SqlParameter("@DeleteBy", UserID);

        msg = AACommon.Execute("ITM_UNIT_TYPE_Delete", Conn, UnitTypeID_P, DeleteBy_P);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #22
0
    public static string InsertRegion(string UnitType, string UserID)
    {
        string        retMessage     = string.Empty;
        string        msg            = "";
        SqlConnection Conn           = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        string        ID             = AACommon.GetAlphaNumericIDSIX("ITM_UNIT_TYPE", "UNIT-", "UnitTypeID", Conn);
        SqlParameter  UnitTypeID_P   = new SqlParameter("@UnitTypeID", ID);
        SqlParameter  UnitTypeDesc_P = new SqlParameter("@UnitTypeDesc", UnitType);
        SqlParameter  CREATEBY       = new SqlParameter("@CreateBy", UserID);

        msg = AACommon.Execute("ITM_UNIT_TYPE_Insert", Conn, UnitTypeID_P, UnitTypeDesc_P, CREATEBY);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #23
0
    public static string InsertRegion(string DeedTitle, string UserID)
    {
        string        retMessage      = string.Empty;
        string        msg             = "";
        SqlConnection Conn            = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        string        ID              = AACommon.GetAlphaNumericIDSIX("Deed", "DEED-", "DeedID", Conn);
        SqlParameter  DistrictID_P    = new SqlParameter("@DeedID", ID);
        SqlParameter  DistrictTitle_P = new SqlParameter("@DeedTitle", DeedTitle);
        SqlParameter  CREATEBY        = new SqlParameter("@CreateBy", UserID);

        msg = AACommon.Execute("SP_Deed_Insert", Conn, DistrictID_P, DistrictTitle_P, CREATEBY);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string rqID  = Request.QueryString["ID"].ToString();
        string LType = Request.QueryString["Type"].ToString();
        string BID   = Request.QueryString["BID"].ToString();

        if (LType == "Detail")
        {
            string        rptName = "PO_His.rpt";
            SqlConnection Con     = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  ReqID   = new SqlParameter("@SPID", rqID);
            SqlParameter  Branch  = new SqlParameter("@BranchID", BID);
            DataSet       ds      = AACommon.ReturnDatasetBySPForREPORT("PurchaseOrderPrint", "vwPurchseOrderPRINT", Con, ReqID, Branch);

            foreach (DataRow dr in ds.Tables["vwPurchseOrderPRINT"].Rows)
            {
                SqlDataAdapter cd = new SqlDataAdapter("select AccountsTitle from Accounts where AccountsID='" + dr["CarryID"].ToString() + "'", Con);
                DataTable      dd = new DataTable();
                cd.Fill(dd);
                if (dd.Rows.Count > 0)
                {
                    dr["CarryTitle"] = dd.Rows[0]["AccountsTitle"].ToString();
                }
            }

            foreach (DataRow dr in ds.Tables["vwPurchseOrderPRINT"].Rows)
            {
                SqlDataAdapter cd = new SqlDataAdapter("select AccountsTitle from Accounts where AccountsID='" + dr["ExChargesID"].ToString() + "'", Con);
                DataTable      dd = new DataTable();
                cd.Fill(dd);
                if (dd.Rows.Count > 0)
                {
                    dr["ExTitle"] = dd.Rows[0]["AccountsTitle"].ToString();
                }
            }

            foreach (DataRow dr in ds.Tables["vwPurchseOrderPRINT"].Rows)
            {
                SqlDataAdapter cd = new SqlDataAdapter("select AccountsTitle from Accounts where AccountsID='" + dr["PackingID"].ToString() + "'", Con);
                DataTable      dd = new DataTable();
                cd.Fill(dd);
                if (dd.Rows.Count > 0)
                {
                    dr["PackingTitle"] = dd.Rows[0]["AccountsTitle"].ToString();
                }
            }

            ds.Tables["vwPurchseOrderPRINT"].AcceptChanges();
            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=vwPurchseOrderPRINT");
        }
        else if (LType == "Local")
        {
            string        rptName = "PO_His_Local.rpt";
            SqlConnection Con     = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  ReqID   = new SqlParameter("@SPID", rqID);
            SqlParameter  Branch  = new SqlParameter("@BranchID", BID);
            DataSet       ds      = AACommon.ReturnDatasetBySPForREPORT("PurchaseOrderPrint", "vwPurchseOrderPRINT", Con, ReqID, Branch);
            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=vwPurchseOrderPRINT");
        }
    }
Пример #25
0
    public static string InsertRegion(string DistrictName, string LoginIDString, string PasswordString, string EmailString, string PhoneString, string ManagerIDString, string UTIDString, string image, string UUserID, string BranchID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        string        ID         = AACommon.GetAlphaNumericIDSIX("USERS", "USR-", "UserID", Conn);
        string        ImageID    = ID;
        //string Pic_Path = HttpContext.Current.Server.MapPath("~/Images/UserImages/");
        //string fileNameWitPath = Pic_Path + ImageID + ".jpg";
        //using (FileStream fs = new FileStream(Pic_Path, FileMode.Create))
        //{
        //    using (BinaryWriter bw = new BinaryWriter(fs))
        //    {
        //        byte[] data = Convert.FromBase64String(image);
        //        bw.Write(data);
        //        bw.Close();
        //    }
        //}

        string path            = HttpContext.Current.Server.MapPath("~/Images/UserImages/");
        string fileNameWitPath = path + ImageID + ".jpg";

        ImageID = ImageID + ".jpg";
        if (image != "No Image")
        {
            using (FileStream fs = new FileStream(fileNameWitPath, FileMode.Create))
            {
                using (BinaryWriter bw = new BinaryWriter(fs))
                {
                    byte[] data = Convert.FromBase64String(image);

                    bw.Write(data);

                    bw.Close();
                }
            }
        }
        else
        {
            image = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCABaAFoDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD7YooooAKKKms7S5v7mOztIzJNKwVFHc/0HvQBDVqz0vUtQOLGwnn944yR+fSvSdA8B6XpiJNfxpd3XUlhmNT/ALKn+ZrplVUUKqgAdAOgoA8euvCWuWFo99fW8VvEgyfMmUHPoADyfaseva9b0Sy16zNnfKxUHejKcMjeo/PvXlPiHw9e+HroQ3WHicZhmUYDj09j6igDKooooAKKKKACiiigArtPhhbxvqV5cMoLRQqF9txOf5CuLrvPhaP3mot/sxD9WoA7+iiigArC8bWsV14bvfMUEwx+ah/usp6/zH41u1keK/8AkXNS/wCvZ/5UAeN0UUUAFFFFABRRRQAV6P8ADOwSLTZ9RWZma4fy2QjhdmcY+ua84r0D4Y6lGYLrSGyJFf7QnoVOAfyIH50Ad3RRRQAVT1ex/tLTLmxMvlCeJkL7c7c98d6uVm+IdSi0nR7q8lJ+WMqgHUueFH50AeLdCeeneigcKB6CigAooooAKKKKACtnwlqsOka9b3Vy22FsxSHsA3GT9Disakb7p+lAHvYIYAg5Bpap6PF5Ok2cJBylvGD/AN8irlABXBfE3VoytvosTZfPny47DooP6n8BXeHpXkHjZs+KL8A9GQYz/sLQBiUUUUAFFFFABRSEgDJNa+keFta1rD2dpthP/LaX5U/DufwoAya6b4faV/aGufaJoFkgtELNvXI3Hhf6n8K6bSfhxpdptk1ORr2Qclfuxj8ByfxNdVBbW9rEsNtAkUa9FRQAPwFAEnA4FLRRQAVwvxN00fZ7bVooV/dsY5mA5w33SfoQR+Nd1TWVXBV1BBGCCM5FAHg3vRXrGreA9B1LdJFbmzmPO+DgZ916GuM1fwDrembpLZVvoRzmIYcD3X/DNAHNUUrKyMUdSrA4IIwR+FJQB6h4f8A6bpgS51FVvLoc/MMxofZe/wBTXVBQMYGMdKB0paACiiigAooooAKKKKACkxmlooAydZ8M6Pri/wCmWoEuMCZPlkH49/oc1yD/AAuv97eXq8GzJ27ojnHbPPWvRaKAP//Z";
            using (FileStream fs = new FileStream(fileNameWitPath, FileMode.Create))
            {
                using (BinaryWriter bw = new BinaryWriter(fs))
                {
                    byte[] data = Convert.FromBase64String(image);

                    bw.Write(data);

                    bw.Close();
                }
            }
        }

        PasswordString = Encryption.Encrypt(PasswordString);
        SqlParameter UserID    = new SqlParameter("@UserID", ID);
        SqlParameter UserName  = new SqlParameter("@UserName", DistrictName);
        SqlParameter loginID   = new SqlParameter("@loginID", LoginIDString);
        SqlParameter Password  = new SqlParameter("@Password", PasswordString);
        SqlParameter email     = new SqlParameter("@email", EmailString);
        SqlParameter Phone     = new SqlParameter("@Phone", PhoneString);
        SqlParameter Picture   = new SqlParameter("@Picture", ImageID);
        SqlParameter ManagerID = new SqlParameter("@ManagerID", ManagerIDString);
        SqlParameter UTID      = new SqlParameter("@UTID", UTIDString);
        SqlParameter CREATEBY  = new SqlParameter("@CREATEBY", UUserID);
        SqlParameter Branch    = new SqlParameter("@BranchID", BranchID);

        msg = AACommon.Execute("USER_INSERT", Conn, UserID, UserName, loginID, Password, email, Phone, Picture, ManagerID, UTID, CREATEBY, Branch);


        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #26
0
    public static string UpdateRegion(string SupplierID, string SupplierTitle, string SupplierCode, string Phone, string Fax, string Email, string AddressLine1, string AddressLine2, string NTN, string GST, string SRB, string opBal, string Bank1Title, string Bank1AccountNo, string Bank1BankName, string Bank2Title, string Bank2AccountNo, string Bank2BankName, string Bank3Title, string Bank3AccountNo, string Bank3BankName)
    {
        string        retMessage       = string.Empty;
        string        msg              = "";
        SqlConnection Conn             = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlParameter  SupplierID_P     = new SqlParameter("@SupplierID", SupplierID);
        SqlParameter  SupplierTitle_P  = new SqlParameter("@SupplierTitle", SupplierTitle);
        SqlParameter  SupplierCode_P   = new SqlParameter("@SupplierCode", SupplierCode);
        SqlParameter  Phone_P          = new SqlParameter("@Phone", Phone);
        SqlParameter  Fax_P            = new SqlParameter("@Fax", Fax);
        SqlParameter  Email_P          = new SqlParameter("@Email", Email);
        SqlParameter  AddressLine1_P   = new SqlParameter("@AddressLine1", AddressLine1);
        SqlParameter  AddressLine2_P   = new SqlParameter("@AddressLine2", AddressLine2);
        SqlParameter  NTN_P            = new SqlParameter("@NTN", NTN);
        SqlParameter  GST_P            = new SqlParameter("@GST", GST);
        SqlParameter  SRB_P            = new SqlParameter("@SRB", SRB);
        SqlParameter  OpBal            = new SqlParameter("@OpBal", opBal);
        SqlParameter  Bank1Title_P     = new SqlParameter("@Bank1Title", Bank1Title);
        SqlParameter  Bank1AccountNo_p = new SqlParameter("@Bank1AccountNo", Bank1Title);
        SqlParameter  Bank1BankName_P  = new SqlParameter("@Bank1BankName", Bank1BankName);
        SqlParameter  Bank2Title_P     = new SqlParameter("@Bank2Title", Bank2Title);
        SqlParameter  Bank2AccountNo_P = new SqlParameter("@Bank2AccountNo", Bank2AccountNo);
        SqlParameter  Bank2BankName_P  = new SqlParameter("@Bank2BankName", Bank2BankName);
        SqlParameter  Bank3Title_P     = new SqlParameter("@Bank3Title", Bank3Title);
        SqlParameter  Bank3AccountNo_P = new SqlParameter("@Bank3AccountNo", Bank3AccountNo);
        SqlParameter  Bank3BankName_P  = new SqlParameter("@Bank3BankName", Bank3BankName);

        msg = AACommon.Execute("Supplier_Update", Conn, SupplierID_P, SupplierTitle_P, SupplierCode_P, Phone_P, Fax_P, Email_P, AddressLine1_P, AddressLine2_P, NTN_P, GST_P, SRB_P, OpBal, Bank1Title_P, Bank1AccountNo_p, Bank1BankName_P, Bank2Title_P, Bank2AccountNo_P, Bank2BankName_P, Bank3Title_P, Bank3AccountNo_P, Bank3BankName_P);

        //cHANGES BY SA/
        //Update_Account_OpBal
        SqlConnection ConACC = new SqlConnection(ConfigurationManager.ConnectionStrings["ConACC"].ConnectionString);
        string        lgrID = AACommon.GetData("select LedgerID from Supplier where SupplierID='" + SupplierID + "'", Conn, "LedgerID");
        string        opD = "0"; string opC = "0";

        if (Convert.ToDecimal(opBal) > 0)
        {
            opD = opBal; opC = "0";
        }
        else if (Convert.ToDecimal(opBal) < 0)
        {
            opD = "0"; opC = opBal;
        }
        SqlParameter L4_ID = new SqlParameter("@L4_ID", lgrID);
        SqlParameter Opcr  = new SqlParameter("@Opcr", opC);
        SqlParameter Opdr  = new SqlParameter("@Opdr", opD);

        AACommon.Execute("Update_Account_OpBal", ConACC, L4_ID, Opcr, Opdr);

        //cHANGES BY SA/

        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #27
0
    public static string SaveTransaction(string UserID, string str, string txtTotAmount, string txtDiscount, string txtTaxRate, string txtTotTax, string txtGrandTotal, string ddlSupplier, string txtDiscountPKR, string txtCusAmountPKR, string ddlShop, string txtCustomerName, string txtContactNo, string txtAddress, string txtBillNo, string BranchID)
    {
        string        msg = "";
        SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);

        string rqID  = "";
        string rqHID = "";
        string rqDt  = "";
        string rqBy  = UserID;
        string rqAt  = "";
        string stsID = "";// 0:Pending, 1:Approved, 2:Rejected


        ///////////////////////// ID GNERATOR /////////////////////////////
        string aa = LoadNUMBER("CS", "SP_MASTER", "SPID", Con, BranchID);

        string[] idDT = aa.Split('`');
        rqID = idDT[0].ToString();
        rqDt = idDT[1].ToString();

        // rqHID = LoadHistoryID(rqID);

        string txtVDate = Convert.ToString(DateTime.Now.Date);


        /////////////////////////// INSERT in SP MASTER //////////////////
        SqlParameter SPID              = new SqlParameter("@SPID", rqID);
        SqlParameter SPDate            = new SqlParameter("@SPDate", DateTime.Now.Date);
        SqlParameter TotalAmount       = new SqlParameter("@TotalAmount", txtTotAmount);
        SqlParameter DiscountAmount    = new SqlParameter("@DiscountAmount", txtDiscount);
        SqlParameter TaxAmount         = new SqlParameter("@TaxAmount", txtTotTax);
        SqlParameter TaxRate           = new SqlParameter("@TaxRate", txtTaxRate);
        SqlParameter GrandTotal        = new SqlParameter("@GrandTotal", txtGrandTotal);
        SqlParameter RMBAmount         = new SqlParameter("@RMBAmount", txtGrandTotal);
        SqlParameter AccountID         = new SqlParameter("@AccountID", ddlSupplier);
        SqlParameter SP                = new SqlParameter("@SP", "S");
        SqlParameter CarryAmountPKR    = new SqlParameter("@CarryAmountPKR", "0");
        SqlParameter CarryAmountRMB    = new SqlParameter("@CarryAmountRMB", "0");
        SqlParameter PackingAmountPKR  = new SqlParameter("@PackingAmountPKR", "0");
        SqlParameter PackingAmountRMB  = new SqlParameter("@PackingAmountRMB", "0");
        SqlParameter ExChargeAmountPKR = new SqlParameter("@ExChargeAmountPKR", "0");
        SqlParameter ExChatgeAmountRMB = new SqlParameter("@ExChatgeAmountRMB", "0");
        SqlParameter SupplierAmountPKR = new SqlParameter("@SupplierAmountPKR", "0");
        SqlParameter SupplierAmountRMB = new SqlParameter("@SupplierAmountRMB", "0");

        SqlParameter SalesDiscountPKR = new SqlParameter("@SalesDiscountPKR", txtDiscountPKR);
        SqlParameter SalesDiscountRMB = new SqlParameter("@SalesDiscountRMB", txtDiscountPKR);
        SqlParameter CusAmountPKR     = new SqlParameter("@CusAmountPKR", txtCusAmountPKR);
        SqlParameter CusAmountRMB     = new SqlParameter("@CusAmountRMB", txtCusAmountPKR);

        SqlParameter CarryID      = new SqlParameter("@CarryID", "0");
        SqlParameter ExChargesID  = new SqlParameter("@ExChargesID", "0");
        SqlParameter PackingID    = new SqlParameter("@PackingID", "0");
        SqlParameter ShopName     = new SqlParameter("@ShopName", ddlShop);
        SqlParameter CustomerName = new SqlParameter("@CustomerName", txtCustomerName);
        SqlParameter CreateBy     = new SqlParameter("@CreateBy", UserID);

        SqlParameter CustomerContactNo = new SqlParameter("@CustomerContactNo", txtContactNo);
        SqlParameter CustomerAddress   = new SqlParameter("@CustomerAddress", txtAddress);
        SqlParameter LocalBillNo       = new SqlParameter("@LocalBillNo", txtBillNo);
        SqlParameter Branch            = new SqlParameter("@BranchID", BranchID);
        SqlParameter CashRcvd          = new SqlParameter("@CashRcvd", txtTotAmount);
        SqlParameter CashBalance       = new SqlParameter("@CashBalance", "0");

        AACommon.Execute("SP_MASTER_INSERT", Con, SPID, SPDate, TotalAmount, DiscountAmount, TaxAmount, TaxRate, GrandTotal, RMBAmount, AccountID, SP, CarryAmountPKR, CarryAmountRMB, PackingAmountPKR, PackingAmountRMB, ExChargeAmountPKR, ExChatgeAmountRMB, SupplierAmountPKR, SupplierAmountRMB, SalesDiscountPKR, SalesDiscountRMB, CusAmountPKR, CusAmountRMB, CarryID, ExChargesID, PackingID, ShopName, CustomerName, CreateBy, CustomerContactNo, CustomerAddress, LocalBillNo, Branch, CashRcvd, CashBalance);


        /////////////////////// INSERT in SP DETAIL

        string[] itmLST = str.Split('`');
        int      b      = 0;

        for (int i = 0; i < itmLST.Length; i++)
        {
            b = b + 1;
            string[] itmROW = itmLST[i].Split('^');
            //txtAccID + "^" + txtAccTitle + "^" + ddlUnit + "^" + txtQty + "^" + txtPrice + "^" + txtTotalPrice
            string itmID         = itmROW[0].ToString();
            string txtQty        = itmROW[1].ToString();
            string txtPrice      = itmROW[2].ToString();
            string txtTotalPrice = itmROW[3].ToString();
            string txtSrNo       = Convert.ToString(b);

            SqlParameter SPID_1        = new SqlParameter("@SPID", rqID);
            SqlParameter ITEMID        = new SqlParameter("@ITEMID", itmID);
            SqlParameter UnitID        = new SqlParameter("@UnitID", "ITEM-000050");
            SqlParameter QtyIn         = new SqlParameter("@QtyIn", txtQty);
            SqlParameter UnitPrice     = new SqlParameter("@UnitPrice", txtPrice);
            SqlParameter TotalPrice    = new SqlParameter("@TotalPrice", txtTotalPrice);
            SqlParameter RMBValue      = new SqlParameter("@RMBValue", txtTotalPrice);
            SqlParameter RMBUnitPrice  = new SqlParameter("@RMBUnitPrice", txtPrice);
            SqlParameter RMBTotalPrice = new SqlParameter("@RMBTotalPrice", txtTotalPrice);
            SqlParameter Type          = new SqlParameter("@Type", "S");

            SqlParameter BasicUnitPricePKR = new SqlParameter("@BasicUnitPricePKR", txtPrice);
            SqlParameter BasicUnitPriceRMB = new SqlParameter("@BasicUnitPriceRMB", txtPrice);
            SqlParameter SRNO         = new SqlParameter("@SrNo", txtSrNo);
            SqlParameter CreateByNew  = new SqlParameter("@CreateBy", UserID);
            SqlParameter BranchP      = new SqlParameter("@BranchID", BranchID);
            SqlParameter DescriptionP = new SqlParameter("@Description", "SALE BY POS");

            AACommon.Execute("SP_DETAIL_INSERT_2", Con, SPID_1, ITEMID, UnitID, QtyIn, UnitPrice, TotalPrice, RMBValue, RMBUnitPrice, RMBTotalPrice, Type,
                             BasicUnitPricePKR, BasicUnitPriceRMB, SRNO, CreateByNew, BranchP, DescriptionP);
        }
        string RMBValueHDN = "0";
        //////////////    PRID = PRID.Replace(" Purchase # : ", "");
        //////////////    PRDID = PRDID.Replace(" ID : ", "");
        //////////////    SqlDataAdapter da = new SqlDataAdapter("select * from  SP_DETAIL where SPID='" + PRID + "' and ITEMID='" + itmID + "' and ID='" + PRDID + "'", Con);
        //////////////    DataTable dt = new DataTable();
        //////////////    da.Fill(dt);
        //////////////    if (dt.Rows.Count > 0)
        //////////////    {
        //////////////        double AvailedQty = Convert.ToDouble(dt.Rows[0]["QtyAvailed"].ToString());
        //////////////        double Qty = Convert.ToDouble(txtQty);
        //////////////        AvailedQty = AvailedQty + Qty;
        //////////////        SqlCommand cmd = new SqlCommand("update SP_DETAIL set QtyAvailed='" + AvailedQty + "' where SPID='" + PRID + "' and ITEMID='" + itmID + "' and ID='" + PRDID + "'", Con);
        //////////////        Con.Open();
        //////////////        cmd.ExecuteNonQuery();
        //////////////        Con.Close();

        //////////////        SqlDataAdapter da1 = new SqlDataAdapter("select MAX(ID) from  SP_DETAIL where SPID='" + rqID + "' and ITEMID='" + itmID + "'", Con);
        //////////////        DataTable dt1 = new DataTable();
        //////////////        da1.Fill(dt1);
        //////////////        if (dt1.Rows.Count > 0)
        //////////////        {
        //////////////            SqlCommand cmd1 = new SqlCommand("update SP_DETAIL set BatchID='" + PRDID + "' where ID='" + dt1.Rows[0][0].ToString() + "'", Con);
        //////////////            Con.Open();
        //////////////            cmd1.ExecuteNonQuery();
        //////////////            Con.Close();
        //////////////        }
        //////////////    }


        //////////////}

        ////////////////////SAVE TRANSACTION IN ACCOUNTS ////////////////////

        string FinalAmountPKR  = "";
        string FinalAmountRMB  = "";
        string txtCusAmountRMB = "";

        if (Convert.ToDouble(txtTotTax) > 0)
        {
            FinalAmountPKR = Convert.ToString(Convert.ToDouble(txtTotAmount) + Convert.ToDouble(txtTotTax));
            FinalAmountRMB = Convert.ToString(Convert.ToDouble(txtTotAmount) + Convert.ToDouble(txtTotTax));
        }
        string     Narration = "Invoice By SO # " + rqID + "";
        SqlCommand cmd2      = new SqlCommand("insert into tbl_transaction (Date,Narration,AmountPKR,AmountRMB,RMBValue,TaskID,CreateBy,BranchID) values ('" + txtVDate + "','" + Narration + "','" + txtTotAmount + "','" + txtTotAmount + "','" + RMBValueHDN + "','" + rqID + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmd2.ExecuteNonQuery();
        Con.Close();

        string         SaleRevenuAccount   = "";
        string         SaleDiscountAccount = "";
        string         SaleTaxAccount      = "";
        SqlDataAdapter daPurchase          = new SqlDataAdapter("select AccountsID from Accounts where BranchID='" + BranchID + "' and AccountsTitle='Sales Revenue'", Con);
        DataTable      dtPurchase          = new DataTable();

        daPurchase.Fill(dtPurchase);
        if (dtPurchase.Rows.Count > 0)
        {
            SaleRevenuAccount = dtPurchase.Rows[0][0].ToString();
        }

        SqlDataAdapter daDiscount = new SqlDataAdapter("select AccountsID from Accounts where BranchID='" + BranchID + "' and AccountsTitle='Sales Discount'", Con);
        DataTable      dtDiscount = new DataTable();

        daDiscount.Fill(dtDiscount);
        if (dtDiscount.Rows.Count > 0)
        {
            SaleDiscountAccount = dtDiscount.Rows[0][0].ToString();
        }

        SqlDataAdapter daTax = new SqlDataAdapter("select AccountsID from Accounts where BranchID='" + BranchID + "' and AccountsTitle='TAX Liability'", Con);
        DataTable      dtTax = new DataTable();

        daTax.Fill(dtTax);
        if (dtTax.Rows.Count > 0)
        {
            SaleTaxAccount = dtTax.Rows[0][0].ToString();
        }


        if (Convert.ToDouble(txtTotTax) > 0)
        {
            txtCusAmountPKR = Convert.ToString(Convert.ToDouble(txtCusAmountPKR) + Convert.ToDouble(txtTotTax));
            txtCusAmountRMB = Convert.ToString(Convert.ToDouble(txtCusAmountRMB) + Convert.ToDouble(txtTotTax));
        }

        ///PURCHASE ENTRY
        SqlCommand cmdPurchase1 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + ddlSupplier + "','SALE','" + txtCusAmountPKR + "','" + txtCusAmountRMB + "','0','0','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmdPurchase1.ExecuteNonQuery();
        Con.Close();

        if (Convert.ToDouble(txtDiscountPKR) > 0)
        {
            Narration = "Sales Discount By SO # " + rqID + "";
            SqlCommand cmdPurchase3 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + SaleDiscountAccount + "','SALE','" + txtDiscountPKR + "','" + txtDiscountPKR + "','0','0','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);
            Con.Open();
            cmdPurchase3.ExecuteNonQuery();
            Con.Close();
        }

        if (Convert.ToDouble(txtTotTax) > 0)
        {
            Narration = "Sales Tax By SO # " + rqID + "";
            SqlCommand cmdPurchase3 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + SaleTaxAccount + "','SALE','0','0','" + txtTotTax + "','" + txtTotTax + "','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);
            Con.Open();
            cmdPurchase3.ExecuteNonQuery();
            Con.Close();
        }

        Narration = "Invoice By SO # " + rqID + "";
        SqlCommand cmdPurchase2 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + SaleRevenuAccount + "','SALE','0','0','" + txtTotAmount + "','" + txtDiscountPKR + "','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmdPurchase2.ExecuteNonQuery();
        Con.Close();
        ///PURCHASE ENTRY


        return(msg);
    }
Пример #28
0
    public static string SaveTransaction(string UserID, string str, string txtVDate, string txtVoucherNo, string txtTotAmount, string txtDiscount, string txtTaxRate, string txtTotTax, string txtGrandTotal, string ddlSupplier, string txtTotAmountRMB, string RMBValueHDN, string txtSupplierPKR, string txtSupplierRMB, string txtDiscountPKR, string txtDiscountRMB, string BranchID, string txtAddress, string txtBillNo)
    {
        string        msg = "";
        SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);

        SqlCommand cmdMasterDelete = new SqlCommand("delete from SP_MASTER where SPID='" + txtVoucherNo + "'", Con);

        Con.Open();
        cmdMasterDelete.ExecuteNonQuery();
        Con.Close();


        SqlCommand cmdDetailDelete = new SqlCommand("delete from SP_DETAIL where SPID='" + txtVoucherNo + "'", Con);

        Con.Open();
        cmdDetailDelete.ExecuteNonQuery();
        Con.Close();


        SqlCommand cmdTransactionMasterDelete = new SqlCommand("delete from tbl_transaction where TaskID='" + txtVoucherNo + "'", Con);

        Con.Open();
        cmdTransactionMasterDelete.ExecuteNonQuery();
        Con.Close();


        SqlCommand cmdTransactionDetailDelete = new SqlCommand("delete from Transaction_Detail where TaskID='" + txtVoucherNo + "'", Con);

        Con.Open();
        cmdTransactionDetailDelete.ExecuteNonQuery();
        Con.Close();

        string rqID  = "";
        string rqHID = "";
        string rqDt  = "";
        string rqBy  = UserID;
        string rqAt  = "";
        string stsID = "";// 0:Pending, 1:Approved, 2:Rejected


        ///////////////////////// ID GNERATOR /////////////////////////////
        string aa = LoadNUMBER("PR", "SP_MASTER", "SPID", Con, BranchID);

        string[] idDT = aa.Split('`');
        rqID = idDT[0].ToString();
        rqDt = idDT[1].ToString();

        // rqHID = LoadHistoryID(rqID);


        rqID = txtVoucherNo;
        rqDt = txtVDate;

        /////////////////////////// INSERT in SP MASTER //////////////////
        SqlParameter SPID           = new SqlParameter("@SPID", rqID);
        SqlParameter SPDate         = new SqlParameter("@SPDate", txtVDate);
        SqlParameter TotalAmount    = new SqlParameter("@TotalAmount", txtTotAmount);
        SqlParameter DiscountAmount = new SqlParameter("@DiscountAmount", txtDiscount);
        SqlParameter TaxAmount      = new SqlParameter("@TaxAmount", txtTotTax);
        SqlParameter TaxRate        = new SqlParameter("@TaxRate", txtTaxRate);
        SqlParameter GrandTotal     = new SqlParameter("@GrandTotal", txtGrandTotal);
        SqlParameter RMBAmount      = new SqlParameter("@RMBAmount", txtTotAmountRMB);
        SqlParameter AccountID      = new SqlParameter("@AccountID", ddlSupplier);
        SqlParameter SP             = new SqlParameter("@SP", "P");

        SqlParameter CarryAmountPKR    = new SqlParameter("@CarryAmountPKR", "0");
        SqlParameter CarryAmountRMB    = new SqlParameter("@CarryAmountRMB", "0");
        SqlParameter PackingAmountPKR  = new SqlParameter("@PackingAmountPKR", "0");
        SqlParameter PackingAmountRMB  = new SqlParameter("@PackingAmountRMB", "0");
        SqlParameter ExChargeAmountPKR = new SqlParameter("@ExChargeAmountPKR", "0");
        SqlParameter ExChatgeAmountRMB = new SqlParameter("@ExChatgeAmountRMB", "0");
        SqlParameter SupplierAmountPKR = new SqlParameter("@SupplierAmountPKR", txtSupplierPKR);
        SqlParameter SupplierAmountRMB = new SqlParameter("@SupplierAmountRMB", txtSupplierRMB);
        SqlParameter SalesDiscountPKR  = new SqlParameter("@SalesDiscountPKR", txtDiscountPKR);
        SqlParameter SalesDiscountRMB  = new SqlParameter("@SalesDiscountRMB", txtDiscountRMB);
        SqlParameter CusAmountPKR      = new SqlParameter("@CusAmountPKR", "0");
        SqlParameter CusAmountRMB      = new SqlParameter("@CusAmountRMB", "0");

        SqlParameter CarryID      = new SqlParameter("@CarryID", "0");
        SqlParameter ExChargesID  = new SqlParameter("@ExChargesID", "0");
        SqlParameter PackingID    = new SqlParameter("@PackingID", "0");
        SqlParameter ShopName     = new SqlParameter("@ShopName", "");
        SqlParameter CustomerName = new SqlParameter("@CustomerName", "");
        SqlParameter CreateBy     = new SqlParameter("@CreateBy", UserID);

        SqlParameter CustomerContactNo = new SqlParameter("@CustomerContactNo", "");
        SqlParameter CustomerAddress   = new SqlParameter("@CustomerAddress", txtAddress);
        SqlParameter LocalBillNo       = new SqlParameter("@LocalBillNo", txtBillNo);
        SqlParameter Branch            = new SqlParameter("@BranchID", BranchID);

        AACommon.Execute("SP_MASTER_INSERT", Con, SPID, SPDate, TotalAmount, DiscountAmount, TaxAmount, TaxRate, GrandTotal, RMBAmount, AccountID, SP, CarryAmountPKR, CarryAmountRMB, PackingAmountPKR, PackingAmountRMB, ExChargeAmountPKR, ExChatgeAmountRMB, SupplierAmountPKR, SupplierAmountRMB, SalesDiscountPKR, SalesDiscountRMB, CusAmountPKR, CusAmountRMB, CarryID, ExChargesID, PackingID, ShopName, CustomerName, CreateBy, CustomerContactNo, CustomerAddress, LocalBillNo, Branch);


        /////////////////////// INSERT in SP DETAIL

        string[] itmLST = str.Split('`');
        for (int i = 0; i < itmLST.Length; i++)
        {
            string[] itmROW = itmLST[i].Split('^');
            //txtAccID + "^" + txtAccTitle + "^" + ddlUnit + "^" + txtQty + "^" + txtPrice + "^" + txtTotalPrice
            string itmID = itmROW[0].ToString();
            //string ddlUnit = itmROW[2].ToString();
            string txtQty        = itmROW[2].ToString();
            string txtPrice      = itmROW[3].ToString();
            string txtTotalPrice = itmROW[4].ToString();

            string txtUnitPriceRMB  = itmROW[5].ToString();
            string txtTotalPriceRMB = itmROW[6].ToString();
            string txtRMBValue      = itmROW[7].ToString();
            //string txtCarry = itmROW[8].ToString();
            //string txtExtraCharges = itmROW[9].ToString();
            //string txtPKRCost = itmROW[10].ToString();
            //string txtRMBCost = itmROW[11].ToString();
            //string txtPackingRate = itmROW[12].ToString();
            //string txtPackingPrice = itmROW[13].ToString();
            //string txtPackingPricePKR = itmROW[14].ToString();
            string txtSrNo = itmROW[8].ToString();
            string BatchID = itmROW[9].ToString();
            string Balance = itmROW[10].ToString();


            SqlParameter SPID_1            = new SqlParameter("@SPID", rqID);
            SqlParameter ITEMID            = new SqlParameter("@ITEMID", itmID);
            SqlParameter UnitID            = new SqlParameter("@UnitID", "UN-000050");
            SqlParameter QtyIn             = new SqlParameter("@QtyIn", txtQty);
            SqlParameter UnitPrice         = new SqlParameter("@UnitPrice", txtPrice);
            SqlParameter TotalPrice        = new SqlParameter("@TotalPrice", txtTotalPrice);
            SqlParameter RMBValue          = new SqlParameter("@RMBValue", txtRMBValue);
            SqlParameter RMBUnitPrice      = new SqlParameter("@RMBUnitPrice", txtUnitPriceRMB);
            SqlParameter RMBTotalPrice     = new SqlParameter("@RMBTotalPrice", txtTotalPriceRMB);
            SqlParameter Type              = new SqlParameter("@Type", "P");
            SqlParameter Carry             = new SqlParameter("@Carry", "0");
            SqlParameter ExtraCharges      = new SqlParameter("@ExtraCharges", "0");
            SqlParameter BasicUnitPricePKR = new SqlParameter("@BasicUnitPricePKR", txtPrice);
            SqlParameter BasicUnitPriceRMB = new SqlParameter("@BasicUnitPriceRMB", txtUnitPriceRMB);
            SqlParameter RMBPackingRate    = new SqlParameter("@RMBPackingRate", "0");
            SqlParameter RMBPackingPrice   = new SqlParameter("@RMBPackingPrice", "0");
            SqlParameter PKRPackingPrice   = new SqlParameter("@PKRPackingPrice", "0");
            SqlParameter SRNO              = new SqlParameter("@SrNo", txtSrNo);
            SqlParameter CreateByNew       = new SqlParameter("@CreateBy", UserID);
            SqlParameter BranchP           = new SqlParameter("@BranchID", BranchID);
            AACommon.Execute("SP_DETAIL_INSERT", Con, SPID_1, ITEMID, UnitID, QtyIn, UnitPrice, TotalPrice, RMBValue, RMBUnitPrice, RMBTotalPrice, Type, Carry, ExtraCharges, BasicUnitPricePKR, BasicUnitPriceRMB, RMBPackingRate, RMBPackingPrice, PKRPackingPrice, SRNO, CreateByNew, BranchP);

            SqlDataAdapter daLast = new SqlDataAdapter("Select Top(1) ID from SP_Detail where SPID='" + txtVoucherNo + "' order by ID Desc", Con);
            DataTable      dtLast = new DataTable();
            daLast.Fill(dtLast);
            if (dtLast.Rows.Count > 0)
            {
                SqlCommand cmdUpdateQtyOut = new SqlCommand("update SP_Detail set QtyAvailed='" + Balance + "' where ID='" + dtLast.Rows[0][0].ToString() + "' and Type='P'", Con);
                Con.Open();
                cmdUpdateQtyOut.ExecuteNonQuery();
                Con.Close();

                SqlCommand cmdupdate = new SqlCommand("update SP_Detail set BatchID='" + dtLast.Rows[0][0].ToString() + "' where BatchID='" + BatchID + "' and Type='S'", Con);
                Con.Open();
                cmdupdate.ExecuteNonQuery();
                Con.Close();
            }
        }

        ////////////////////SAVE TRANSACTION IN ACCOUNTS ////////////////////

        double totafterdiscountPKR = Convert.ToDouble(txtSupplierPKR);
        double totafterdiscountRMB = Convert.ToDouble(txtSupplierRMB);

        string     Narration = "Purchase By PO # " + rqID + "";
        SqlCommand cmd       = new SqlCommand("insert into tbl_transaction (Date,Narration,AmountPKR,AmountRMB,RMBValue,TaskID,CreateBy,BranchID) values ('" + txtVDate + "','" + Narration + "','" + totafterdiscountPKR + "','" + totafterdiscountRMB + "','" + RMBValueHDN + "','" + rqID + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmd.ExecuteNonQuery();
        Con.Close();

        string         PurchaseAccount = "";
        SqlDataAdapter daPurchase      = new SqlDataAdapter("select AccountsID from Accounts where BranchID='" + BranchID + "' and AccountsTitle='Purchases'", Con);
        DataTable      dtPurchase      = new DataTable();

        daPurchase.Fill(dtPurchase);
        if (dtPurchase.Rows.Count > 0)
        {
            PurchaseAccount = dtPurchase.Rows[0][0].ToString();
        }



        ///PURCHASE ENTRY
        SqlCommand cmdPurchase1 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + PurchaseAccount + "','PURCHASE','" + totafterdiscountPKR + "','" + totafterdiscountRMB + "','0','0','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmdPurchase1.ExecuteNonQuery();
        Con.Close();

        SqlCommand cmdPurchase2 = new SqlCommand("insert into Transaction_Detail (Date,AccountID,TransactionType,DebitPKR,DebitRMB,CreditPKR,CreditRMB,RMBValue,TaskID,Narration,CreateBy,BranchID) values ('" + txtVDate + "','" + ddlSupplier + "','PURCHASE','0','0','" + txtSupplierPKR + "','" + txtSupplierRMB + "','" + RMBValueHDN + "','" + rqID + "','" + Narration + "','" + UserID + "','" + BranchID + "')", Con);

        Con.Open();
        cmdPurchase2.ExecuteNonQuery();
        Con.Close();

        return(msg + rqID);
    }
Пример #29
0
    public static string InsertRegion(string SupplierTitle, string SupplierCode, string Phone, string Fax, string Email, string AddressLine1, string AddressLine2, string NTN, string GST, string SRB, string opBal, string UserID)
    {
        string        retMessage = string.Empty;
        string        msg        = "";
        SqlConnection Conn       = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
        SqlConnection ConACC     = new SqlConnection(ConfigurationManager.ConnectionStrings["ConACC"].ConnectionString);

        string       ID              = AACommon.GetAlphaNumericIDSIX("Supplier", "SIP-", "SupplierID", Conn);
        SqlParameter SupplierID_P    = new SqlParameter("@SupplierID", ID);
        SqlParameter SupplierTitle_P = new SqlParameter("@SupplierTitle", SupplierTitle);
        SqlParameter SupplierCode_P  = new SqlParameter("@SupplierCode", SupplierCode);
        SqlParameter Phone_P         = new SqlParameter("@Phone", Phone);
        SqlParameter Fax_P           = new SqlParameter("@Fax", Fax);
        SqlParameter Email_P         = new SqlParameter("@Email", Email);
        SqlParameter AddressLine1_P  = new SqlParameter("@AddressLine1", AddressLine1);
        SqlParameter AddressLine2_P  = new SqlParameter("@AddressLine2", AddressLine2);
        SqlParameter NTN_P           = new SqlParameter("@NTN", NTN);
        SqlParameter GST_P           = new SqlParameter("@GST", GST);
        SqlParameter SRB_P           = new SqlParameter("@SRB", SRB);
        SqlParameter OpBal           = new SqlParameter("@OpBal", opBal);
        SqlParameter CREATEBY        = new SqlParameter("@CreateBy", UserID);

        msg = AACommon.Execute("Supplier_Insert", Conn, SupplierID_P, SupplierTitle_P, SupplierCode_P, Phone_P, Fax_P, Email_P, AddressLine1_P, AddressLine2_P, NTN_P, GST_P, SRB_P, OpBal, CREATEBY);



        /////////////////////ACCOUNTS /////////////////////////
        string opD = "0"; string opC = "0";

        if (Convert.ToDecimal(opBal) > 0)
        {
            opD = opBal; opC = "0";
        }
        else if (Convert.ToDecimal(opBal) < 0)
        {
            opD = "0"; opC = opBal;
        }

        string       L4ID              = AACommon.GetData("SELECT AccountID FROM AACCOUNTS_Integration WHERE (Description = 'Vendors')", ConACC, "AccountID");
        string       ledgerID          = AACommon.GetAlphaNumericIDTHREE("Accounts", L4ID, "L4_ID", ConACC);
        SqlParameter L4_ID             = new SqlParameter("@L4_ID", ledgerID);
        SqlParameter Desc_Level4       = new SqlParameter("@Desc_Level4", SupplierTitle);
        SqlParameter L4_IDNew          = new SqlParameter("@L4_IDNew", L4ID);
        SqlParameter Opdr              = new SqlParameter("@Opdr", opD);
        SqlParameter Opcr              = new SqlParameter("@Opcr", opC);
        SqlParameter CompanyID         = new SqlParameter("@CompanyID", "12");
        SqlParameter FiscalID          = new SqlParameter("@FiscalID", "22");
        SqlParameter BalanceValidation = new SqlParameter("@BalanceValidation", "0");

        AACommon.Execute("Insert_Accounts", ConACC, L4_ID, Desc_Level4, L4_IDNew, Opdr, Opcr, CompanyID, FiscalID, BalanceValidation);
        /////////////////////////////////////

        string     str = "update Supplier set LedgerID='" + ledgerID + "' where SupplierID='" + ID + "'";
        SqlCommand cmd = new SqlCommand(str, Conn);

        if (Conn.State == ConnectionState.Closed)
        {
            Conn.Open();
        }
        cmd.ExecuteNonQuery();
        if (Conn.State == ConnectionState.Open)
        {
            Conn.Close();
        }



        if (msg == "Record Saved Successfully")
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

        return(retMessage);
    }
Пример #30
0
    protected void LoadReportCatBrand(object sender, EventArgs e)
    {
        var    BranchID = "";
        var    UTDesc   = "";
        string Type     = Request.QueryString["Type"].ToString();

        if (Request.Cookies["BranchID"] != null)
        {
            BranchID = Request.Cookies["BranchID"].Value;
        }
        if (Request.Cookies["UTDesc"] != null)
        {
            UTDesc = Request.Cookies["UTDesc"].Value;
        }

        if (Type == "Stock-Summary")
        {
            string        rptName    = "Stock.rpt";
            SqlConnection Con        = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  AccountsID = new SqlParameter("@CatID", ddlCategory.SelectedValue);
            SqlParameter  BrandID    = new SqlParameter("@BrandID", ddlBrand.SelectedValue);
            SqlParameter  Branch     = new SqlParameter("@BranchID", BranchID);
            DataSet       ds         = AACommon.ReturnDatasetBySPForREPORT("STOCK_BALANCE_CAT_BRAND", "VW_STOCK_BALANCE", Con, AccountsID, BrandID, Branch);
            if (UTDesc == "Sales")
            {
                for (int intCount = 0; intCount < ds.Tables[0].Rows.Count; intCount++)
                {
                    ds.Tables[0].Rows[intCount]["UnitPrice"]    = "0";
                    ds.Tables[0].Rows[intCount]["UnitPriceOld"] = "0";
                }

                ds.Tables[0].AcceptChanges();
            }

            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=VW_STOCK_BALANCE");
        }
        else
        if (Type == "Stock-Ledger")
        {
            string        rptName    = "StockLedger.rpt";
            SqlConnection Con        = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
            SqlParameter  AccountsID = new SqlParameter("@CatID", ddlCategory.SelectedValue);
            SqlParameter  BrandID    = new SqlParameter("@BrandID", ddlBrand.SelectedValue);
            SqlParameter  Branch     = new SqlParameter("@BranchID", BranchID);
            DataSet       ds         = AACommon.ReturnDatasetBySPForREPORT("STOCK_LEDGER_CAT_BRAND", "VW_STOCK_LEDGER", Con, AccountsID, BrandID, Branch);
            if (UTDesc == "Sales")
            {
                for (int intCount = 0; intCount < ds.Tables[0].Rows.Count; intCount++)
                {
                    ds.Tables[0].Rows[intCount]["UnitPrice"]  = "0";
                    ds.Tables[0].Rows[intCount]["TotalPrice"] = "0";
                }

                ds.Tables[0].AcceptChanges();
            }

            Session["RptDS"] = ds;
            Response.Redirect("~/Reports/Viewer.aspx?name=" + rptName + "&no=0&RptTable=VW_STOCK_LEDGER");
        }
    }