예제 #1
0
        private Int64 SaveRecord()
        {
            WBranchTransfer clsWBranchTransfer = new WBranchTransfer();

            clsWBranchTransfer.GetConnection();
            lblWBranchTransferNo.Text = Constants.BRANCH_TRANSFER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsWBranchTransfer.LastTransactionNo();

            WBranchTransferDetails clsDetails = new WBranchTransferDetails();

            clsDetails.WBranchTransferNo    = lblWBranchTransferNo.Text;
            clsDetails.WBranchTransferDate  = Convert.ToDateTime(lblWBranchTransferDate.Text);
            clsDetails.BranchIDFrom         = Convert.ToInt16(cboBranchFrom.SelectedItem.Value);
            clsDetails.BranchIDTo           = Convert.ToInt16(cboBranchTo.SelectedItem.Value);
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.TransferrerID        = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.TransferrerName      = Session["Name"].ToString();
            clsDetails.RequestedBy          = txtRequestedBy.Text;
            clsDetails.Status  = WBranchTransferStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            Int64 id = clsWBranchTransfer.Insert(clsDetails);

            clsWBranchTransfer.CommitAndDispose();

            return(id);
        }
예제 #2
0
        private void LoadRecord()
        {
            Int64                  iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID));
            WBranchTransfer        clsWBranchTransfer = new WBranchTransfer();
            WBranchTransferDetails clsDetails         = clsWBranchTransfer.Details(iID);

            clsWBranchTransfer.CommitAndDispose();

            lblWBranchTransferID.Text      = clsDetails.WBranchTransferID.ToString();
            lblWBranchTransferNo.Text      = clsDetails.WBranchTransferNo;
            lblWBranchTransferDate.Text    = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredDeliveryDate.Text   = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            lblBranchCodeFrom.Text         = clsDetails.BranchCodeFrom;
            lblBranchCodeTo.Text           = clsDetails.BranchCodeTo;
            lblWBranchTransferRemarks.Text = clsDetails.Remarks;

            txtWBranchTransferDiscountApplied.Text       = clsDetails.DiscountApplied.ToString("###0.#0");
            cboWBranchTransferDiscountType.SelectedIndex = cboWBranchTransferDiscountType.Items.IndexOf(cboWBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d")));
            lblWBranchTransferDiscount.Text      = clsDetails.Discount.ToString("#,##0.#0");
            lblWBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtWBranchTransferFreight.Text       = clsDetails.Freight.ToString("#,##0.#0");
            txtWBranchTransferDeposit.Text       = clsDetails.Deposit.ToString("#,##0.#0");
            lblWBranchTransferSubTotal.Text      = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0");
            lblWBranchTransferVAT.Text           = clsDetails.VAT.ToString("#,##0.#0");
            lblWBranchTransferTotal.Text         = clsDetails.SubTotal.ToString("#,##0.#0");
        }
예제 #3
0
        private void SetDataSource(ReportDocument Report)
        {
            long iID = 0;

            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["WBranchTransferid"].ToString() != null)
                {
                    iID = Convert.ToInt64(Request.QueryString["WBranchTransferid"].ToString());
                }
                else
                {
                    iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferid"].ToString(), Session.SessionID));
                }
            }
            catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("WBranchTransferid") + 13), Session.SessionID)); }

            ReportDataset rptds = new ReportDataset();

            WBranchTransfer clsWBranchTransfer = new WBranchTransfer();

            System.Data.DataTable dt = clsWBranchTransfer.ListAsDataTable(iID);
            WBranchTransferItem   clsWBranchTransferItem = new WBranchTransferItem(clsWBranchTransfer.Connection, clsWBranchTransfer.Transaction);

            System.Data.DataTable dtitems = clsWBranchTransferItem.ListAsDataTable(iID);
            clsWBranchTransfer.CommitAndDispose();

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.WBranchTransfer.NewRow();

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

                rptds.WBranchTransfer.Rows.Add(drNew);
            }
            foreach (System.Data.DataRow dr in dtitems.Rows)
            {
                DataRow drNew = rptds.WBranchTransferItems.NewRow();

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

                rptds.WBranchTransferItems.Rows.Add(drNew);
            }

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }
예제 #4
0
        private void CancelWBranchTransfer()
        {
            long   WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text);
            string Remarks           = txtRemarks.Text;

            WBranchTransfer clsWBranchTransfer = new WBranchTransfer();

            clsWBranchTransfer.Cancel(WBranchTransferID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString()));
            clsWBranchTransfer.CommitAndDispose();

            Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID));
        }
예제 #5
0
        private void LoadRecord()
        {
            Int64                  iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID));
            WBranchTransfer        clsWBranchTransfer = new WBranchTransfer();
            WBranchTransferDetails clsDetails         = clsWBranchTransfer.Details(iID);

            clsWBranchTransfer.CommitAndDispose();

            lblWBranchTransferID.Text    = clsDetails.WBranchTransferID.ToString();
            lblWBranchTransferNo.Text    = clsDetails.WBranchTransferNo;
            lblWBranchTransferDate.Text  = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss");
            txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            cboBranchFrom.SelectedIndex  = cboBranchFrom.Items.IndexOf(cboBranchFrom.Items.FindByValue(clsDetails.BranchIDFrom.ToString()));
            cboBranchTo.SelectedIndex    = cboBranchTo.Items.IndexOf(cboBranchTo.Items.FindByValue(clsDetails.BranchIDTo.ToString()));
            txtRequestedBy.Text          = clsDetails.RequestedBy;
            txtRemarks.Text = clsDetails.Remarks;
        }
예제 #6
0
        private void SaveRecord()
        {
            WBranchTransferDetails clsDetails = new WBranchTransferDetails();

            clsDetails.WBranchTransferID    = long.Parse(lblWBranchTransferID.Text);
            clsDetails.WBranchTransferNo    = lblWBranchTransferNo.Text;
            clsDetails.WBranchTransferDate  = Convert.ToDateTime(lblWBranchTransferDate.Text);
            clsDetails.BranchIDFrom         = Convert.ToInt16(cboBranchFrom.SelectedItem.Value);
            clsDetails.BranchIDTo           = Convert.ToInt16(cboBranchTo.SelectedItem.Value);
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.TransferrerID        = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.TransferrerName      = Session["Name"].ToString();
            clsDetails.RequestedBy          = txtRequestedBy.Text;
            clsDetails.Status  = WBranchTransferStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            WBranchTransfer clsWBranchTransfer = new WBranchTransfer();

            clsWBranchTransfer.Update(clsDetails);
            clsWBranchTransfer.CommitAndDispose();
        }
예제 #7
0
        private void LoadList()
        {
            WBranchTransfer clsWBranchTransfer = new WBranchTransfer();
            DataClass       clsDataClass       = new DataClass();
            Common          Common             = new Common();

            string SortField = "WBranchTransferID";

            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);
            }

            DateTime dteTransferStartDate = DateTime.MinValue;

            try { if (txtTransferStartDate.Text != string.Empty)
                  {
                      dteTransferStartDate = Convert.ToDateTime(txtTransferStartDate.Text + " " + txtTransferStartTime.Text);
                  }
            }
            catch { }

            DateTime dteTransferEndDate = DateTime.MinValue;

            try { if (txtTransferEndDate.Text != string.Empty)
                  {
                      dteTransferEndDate = Convert.ToDateTime(txtTransferEndDate.Text + " " + txtTransferEndTime.Text);
                  }
            }
            catch { }

            DateTime dtePostingStartDate = DateTime.MinValue;

            try { if (txtPostingStartDate.Text != string.Empty)
                  {
                      dtePostingStartDate = Convert.ToDateTime(txtPostingStartDate.Text + " " + txtPostingStartTime.Text);
                  }
            }
            catch { }

            DateTime dtePostingEndDate = DateTime.MinValue;

            try { if (txtPostingEndDate.Text != string.Empty)
                  {
                      dtePostingEndDate = Convert.ToDateTime(txtPostingEndDate.Text + " " + txtPostingEndTime.Text);
                  }
            }
            catch { }

            WBranchTransferDetails searchKey = new WBranchTransferDetails();

            searchKey.WBranchTransferNo = txtSearch.Text;

            WBranchTransferStatus status = (WBranchTransferStatus)Enum.Parse(typeof(WBranchTransferStatus), cboStatus.SelectedItem.Value);

            PageData.DataSource = clsWBranchTransfer.ListAsDataTable(0, 0, searchKey, status, dteTransferStartDate, dteTransferEndDate, dtePostingStartDate, dtePostingEndDate, null, null, SortField, sortoption).DefaultView;
            clsWBranchTransfer.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;
        }