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.CloseInventoryByProductGroup(int.Parse(cboBranch.SelectedItem.Value), clsAccessUserDetails.UID, DateTime.Parse(txtClosingDate.Text), strReferenceNo, long.Parse(cboProductGroup.SelectedItem.Value), cboProductGroup.SelectedItem.Text); Products clsProducts = new Products(clsERPConfig.Connection, clsERPConfig.Transaction); clsProducts.LockUnlockForSellingByProductGroup(int.Parse(cboBranch.SelectedItem.Value), long.Parse(cboProductGroup.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; }
public string LastTransactionNo() { try { string stRetValue = String.Empty; ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); stRetValue = clsERPConfig.get_LastClosingNo(); return stRetValue; } catch (Exception ex) { throw base.ThrowException(ex); } }