Beispiel #1
0
        private void Post()
        {
            DateTime DeliveryDate = Convert.ToDateTime(txtPostDate.Text);

            ERPConfig        clsERPConfig        = new ERPConfig();
            ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details();

            clsERPConfig.CommitAndDispose();

            if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate)
            {
                long   CreditMemoID  = Convert.ToInt64(lblCreditMemoID.Text);
                string CustomerDocNo = txtCustomerDocNo.Text;

                SOReturns clsSOReturns = new SOReturns();
                clsSOReturns.Post(CreditMemoID, CustomerDocNo, DeliveryDate);
                clsSOReturns.CommitAndDispose();

                Common Common  = new Common();
                string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&retid=" + Common.Encrypt(CreditMemoID.ToString(), Session.SessionID);
                Response.Redirect("Default.aspx" + stParam);
            }
            else
            {
                string stScript = "<Script>";
                stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtPostDate.Text + ". Please enter an allowable posting date.')";
                stScript += "</Script>";
                Response.Write(stScript);
            }
        }
Beispiel #2
0
        private void SetDataSource(ReportDocument Report)
        {
            long iID = 0;

            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["retid"].ToString() != null)
                {
                    iID = Convert.ToInt64(Request.QueryString["retid"].ToString());
                }
                else
                {
                    iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"].ToString(), Session.SessionID));
                }
                lblReferrer.ToolTip = iID.ToString();
            }
            catch { iID = long.Parse(lblReferrer.ToolTip); }

            ReportDataset rptds = new ReportDataset();

            SOReturns       clsSOReturns = new SOReturns();
            MySqlDataReader myreader     = clsSOReturns.List(iID, "CreditMemoID", SortOption.Ascending);

            while (myreader.Read())
            {
                DataRow drNew = rptds.SOReturns.NewRow();

                foreach (DataColumn dc in rptds.SOReturns.Columns)
                {
                    drNew[dc] = "" + myreader[dc.ColumnName];
                }

                rptds.SOReturns.Rows.Add(drNew);
            }
            myreader.Close();


            SOReturnItems clsSOReturnItems = new SOReturnItems(clsSOReturns.Connection, clsSOReturns.Transaction);

            System.Data.DataTable dt = clsSOReturnItems.ListAsDataTable(iID);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.SOReturnItems.NewRow();

                foreach (DataColumn dc in rptds.SOReturnItems.Columns)
                {
                    drNew[dc] = "" + dr[dc.ColumnName];
                }

                rptds.SOReturnItems.Rows.Add(drNew);
            }
            clsSOReturns.CommitAndDispose();

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }
Beispiel #3
0
		private void CancelSOReturn()
		{
			long CreditMemoID = Convert.ToInt64(lblCreditMemoID.Text);
			string Remarks = txtRemarks.Text;

            SOReturns clsSOReturns = new SOReturns();
            clsSOReturns.Cancel(CreditMemoID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString()));
            clsSOReturns.CommitAndDispose();

			Common Common = new Common();
			Response.Redirect("Default.aspx?task=" + Common.Encrypt("list",Session.SessionID));		
		}
Beispiel #4
0
        private void UpdateDeposit()
        {
            SOReturnDetails clsSOReturnDetails = new SOReturnDetails();

            clsSOReturnDetails.CreditMemoID = Convert.ToInt64(lblCreditMemoID.Text);
            clsSOReturnDetails.Deposit      = Convert.ToDecimal(txtSODeposit.Text);

            SOReturns clsSOReturns = new SOReturns();

            clsSOReturns.UpdateDeposit(clsSOReturnDetails.CreditMemoID, clsSOReturnDetails.Deposit);
            clsSOReturns.SynchronizeAmount(clsSOReturnDetails.CreditMemoID);
            clsSOReturnDetails = clsSOReturns.Details(clsSOReturnDetails.CreditMemoID);
            clsSOReturns.CommitAndDispose();

            UpdateFooter(clsSOReturnDetails);
        }
Beispiel #5
0
        private void UpdateSODiscount()
        {
            SOReturnDetails clsSOReturnDetails = new SOReturnDetails();

            clsSOReturnDetails.CreditMemoID    = Convert.ToInt64(lblCreditMemoID.Text);
            clsSOReturnDetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSOReturnDetails.DiscountType    = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SOReturns clsSOReturns = new SOReturns();

            clsSOReturns.UpdateDiscount(clsSOReturnDetails.CreditMemoID, clsSOReturnDetails.DiscountApplied, clsSOReturnDetails.DiscountType);
            clsSOReturns.SynchronizeAmount(Convert.ToInt64(lblCreditMemoID.Text));
            clsSOReturnDetails = clsSOReturns.Details(Convert.ToInt64(lblCreditMemoID.Text));
            clsSOReturns.CommitAndDispose();

            UpdateFooter(clsSOReturnDetails);
        }
Beispiel #6
0
        private void LoadRecord()
        {
            Common          Common       = new Common();
            Int64           iID          = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"], Session.SessionID));
            SOReturns       clsSOReturns = new SOReturns();
            SOReturnDetails clsDetails   = clsSOReturns.Details(iID);

            clsSOReturns.CommitAndDispose();

            lblCreditMemoID.Text       = clsDetails.CreditMemoID.ToString();
            lblReturnNo.Text           = clsDetails.CNNo;
            lblReturnDate.Text         = clsDetails.CNDate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredReturnDate.Text = clsDetails.RequiredPostingDate.ToString("yyyy-MM-dd");
            lblCustomerID.Text         = clsDetails.CustomerID.ToString();

            lblCustomerCode.Text = clsDetails.CustomerCode.ToString();
            string stParam = "?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.CustomerID.ToString(), Session.SessionID);

            lblCustomerCode.NavigateUrl = Constants.ROOT_DIRECTORY + "/SalesAndReceivables/_Customer/Default.aspx" + stParam;

            lblCustomerContact.Text     = clsDetails.CustomerContact;
            lblCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo;
            lblTerms.Text = clsDetails.CustomerTerms.ToString("##0");
            switch (clsDetails.CustomerModeOfTerms)
            {
            case 0:
                lblModeOfterms.Text = "Days";
                break;

            case 1:
                lblModeOfterms.Text = "Months";
                break;

            case 2:
                lblModeOfterms.Text = "Years";
                break;
            }
            lblCustomerAddress.Text = clsDetails.CustomerAddress;
            lblBranchID.Text        = clsDetails.BranchID.ToString();
            lblBranchCode.Text      = clsDetails.BranchCode;
            lblBranchAddress.Text   = clsDetails.BranchAddress;
            lblReturnRemarks.Text   = clsDetails.Remarks;

            UpdateFooter(clsDetails);
        }
Beispiel #7
0
        private long SaveRecord()
        {
            SOReturns clsSOReturns = new SOReturns();

            clsSOReturns.GetConnection();
            lblReturnNo.Text = Constants.SALES_RETURN_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsSOReturns.LastTransactionNo();

            SOReturnDetails clsDetails = new SOReturnDetails();

            clsDetails.CNNo                = lblReturnNo.Text;
            clsDetails.CNDate              = Convert.ToDateTime(lblReturnDate.Text);
            clsDetails.CustomerID          = Convert.ToInt64(cboCustomer.SelectedItem.Value);
            clsDetails.CustomerCode        = cboCustomer.SelectedItem.Text;
            clsDetails.CustomerContact     = txtCustomerContact.Text;
            clsDetails.CustomerAddress     = txtCustomerAddress.Text;
            clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text;
            clsDetails.CustomerTerms       = Convert.ToInt32(lblTerms.Text);
            switch (lblModeOfterms.Text)
            {
            case "Days":
                clsDetails.CustomerModeOfTerms = 0;
                break;

            case "Months":
                clsDetails.CustomerModeOfTerms = 1;
                break;

            case "Years":
                clsDetails.CustomerModeOfTerms = 2;
                break;
            }
            clsDetails.RequiredPostingDate = Convert.ToDateTime(txtRequiredReturnDate.Text);
            clsDetails.BranchID            = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.SellerID            = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.SellerName          = Session["Name"].ToString();
            clsDetails.ReturnStatus        = SOReturnStatus.Open;
            clsDetails.Remarks             = txtRemarks.Text;

            long id = clsSOReturns.Insert(clsDetails);

            clsSOReturns.CommitAndDispose();

            return(id);
        }
Beispiel #8
0
        private void SaveRecord()
        {
            SOReturnDetails clsDetails = new SOReturnDetails();

            clsDetails.CreditMemoID        = Convert.ToInt64(lblCreditMemoID.Text);
            clsDetails.CNNo                = lnkReturnNo.Text;
            clsDetails.CNDate              = Convert.ToDateTime(lblReturnDate.Text);
            clsDetails.CustomerID          = Convert.ToInt64(cboCustomer.SelectedItem.Value);
            clsDetails.CustomerCode        = cboCustomer.SelectedItem.Text;
            clsDetails.CustomerContact     = txtCustomerContact.Text;
            clsDetails.CustomerAddress     = txtCustomerAddress.Text;
            clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text;
            switch (lblModeOfterms.Text)
            {
            case "Days":
                clsDetails.CustomerModeOfTerms = 0;
                break;

            case "Months":
                clsDetails.CustomerModeOfTerms = 1;
                break;

            case "Years":
                clsDetails.CustomerModeOfTerms = 2;
                break;
            }
            clsDetails.RequiredPostingDate = Convert.ToDateTime(txtRequiredReturnDate.Text);
            clsDetails.BranchID            = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.SellerID            = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.SellerName          = Session["Name"].ToString();
            clsDetails.ReturnStatus        = SOReturnStatus.Open;
            clsDetails.Remarks             = txtRemarks.Text;

            SOReturns clsSOReturns = new SOReturns();

            clsSOReturns.Update(clsDetails);
            clsSOReturns.CommitAndDispose();
        }
Beispiel #9
0
        private void LoadRecord()
        {
            Common          Common       = new Common();
            Int64           iID          = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"], Session.SessionID));
            SOReturns       clsSOReturns = new SOReturns();
            SOReturnDetails clsDetails   = clsSOReturns.Details(iID);

            clsSOReturns.CommitAndDispose();

            lblCreditMemoID.Text    = clsDetails.CreditMemoID.ToString();
            lnkReturnNo.Text        = clsDetails.CNNo;
            lnkReturnNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&retid=" + Common.Encrypt(clsDetails.CreditMemoID.ToString(), Session.SessionID);

            lblReturnDate.Text          = clsDetails.CNDate.ToString("yyyy-MM-dd HH:mm:ss");
            txtRequiredReturnDate.Text  = clsDetails.RequiredPostingDate.ToString("yyyy-MM-dd");
            cboCustomer.SelectedIndex   = cboCustomer.Items.IndexOf(cboCustomer.Items.FindByValue(clsDetails.CustomerID.ToString()));
            txtCustomerContact.Text     = clsDetails.CustomerContact;
            txtCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo;
            lblTerms.Text = clsDetails.CustomerTerms.ToString("##0");
            switch (clsDetails.CustomerModeOfTerms)
            {
            case 0:
                lblModeOfterms.Text = "Days";
                break;

            case 1:
                lblModeOfterms.Text = "Months";
                break;

            case 2:
                lblModeOfterms.Text = "Years";
                break;
            }
            txtCustomerAddress.Text = clsDetails.CustomerAddress;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString()));
            txtBranchAddress.Text   = clsDetails.BranchAddress;
            txtRemarks.Text         = clsDetails.Remarks;
        }
Beispiel #10
0
        private void LoadList()
        {
            SOReturns clsSOReturns = new SOReturns();
            DataClass clsDataClass = new DataClass();
            Common    Common       = new Common();

            string SortField = "CreditMemoID";

            if (Request.QueryString["sortfield"] != null)
            {
                SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
            }

            SortOption sortoption = SortOption.Ascending;

            if (Request.QueryString["sortoption"] != null)
            {
                sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
            }

            if (Request.QueryString["Search"] == null)
            {
                PageData.DataSource = clsSOReturns.ListAsDataTable(SOReturnStatus.Open, SortField, sortoption).DefaultView;
            }
            else
            {
                string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID);
                PageData.DataSource = clsSOReturns.SearchAsDataTable(SOReturnStatus.Open, SearchKey, SortField, sortoption).DefaultView;
            }

            clsSOReturns.CommitAndDispose();

            int iPageSize = Convert.ToInt16(Session["PageSize"]);

            PageData.AllowPaging = true;
            PageData.PageSize    = iPageSize;
            try
            {
                PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }
            catch
            {
                PageData.CurrentPageIndex = 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }

            cboCurrentPage.Items.Clear();
            for (int i = 0; i < PageData.PageCount; i++)
            {
                int iValue = i + 1;
                cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                if (PageData.CurrentPageIndex == i)
                {
                    cboCurrentPage.Items[i].Selected = true;
                }
                else
                {
                    cboCurrentPage.Items[i].Selected = false;
                }
            }
            lblDataCount.Text = " of " + " " + PageData.PageCount;
        }