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; CreditMemos clsCreditMemos = new CreditMemos(); clsCreditMemos.Post(CreditMemoID, CustomerDocNo, DeliveryDate); clsCreditMemos.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); } }
private void IssueGRN() { DateTime DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { long BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); string ReceivedBy = txtReceivedBy.Text; BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.IssueGRN(BranchTransferID, ReceivedBy, DeliveryDate); clsBranchTransfer.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&BranchTransferID=" + Common.Encrypt(BranchTransferID.ToString(), Session.SessionID); Response.Redirect("Default.aspx" + stParam); } else { string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtDeliveryDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } }
private void LoadRecord() { ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); txtDateFrom.Text = clsDetails.PostingDateFrom.ToString("yyyy-MM-dd"); txtDateTo.Text = clsDetails.PostingDateTo.ToString("yyyy-MM-dd"); }
private string CloseInventory() { string strRetValue = ""; try { DateTime DeliveryDate = Convert.ToDateTime(txtClosingDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { string strReferenceNo = Constants.CLOSE_INVENTORY_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsERPConfig.get_LastClosingNo(); AccessUserDetails clsAccessUserDetails = (AccessUserDetails)Session["AccessUserDetails"]; ProductInventories clsProductInventories = new ProductInventories(clsERPConfig.Connection, clsERPConfig.Transaction); clsProductInventories.CloseInventoryBySupplier(int.Parse(cboBranch.SelectedItem.Value), clsAccessUserDetails.UID, DateTime.Parse(txtClosingDate.Text), strReferenceNo, long.Parse(cboContact.SelectedItem.Value), cboContact.SelectedItem.Text); Products clsProducts = new Products(clsERPConfig.Connection, clsERPConfig.Transaction); clsProducts.LockUnlockForSellingBySupplier(int.Parse(cboBranch.SelectedItem.Value), long.Parse(cboContact.SelectedItem.Value), false); clsERPConfig.CommitAndDispose(); strRetValue = strReferenceNo; } else { clsERPConfig.CommitAndDispose(); string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot close using the closing date: " + txtClosingDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } } catch (Exception ex) { string stScript = "<Script>"; stScript += "window.alert('An error has occured while closing the inventory. Details:' " + ex.Message + ")"; stScript += "</Script>"; Response.Write(stScript); } return(strRetValue); }