private void BuildGrandTotalLabel() { if (PRMWorkOrderID > 0) { String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, PRMWorkOrderID.ToString(), SQLMatchType.Equal); IList <PRMWorkOrderItemMapEntity> lst = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(100000, 1, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lst != null && lst.Count > 0) { var transinfo = (from transaction in lst select transaction.RequiredQty * transaction.Rate).Sum(val => val); PRMWorkOrderEntity pRMWorkOrderEntity = FCCPRMWorkOrder.GetFacadeCreate().GetByID(PRMWorkOrderID); Decimal totalPrice = transinfo; Decimal AIT, Discount, Vat, Tax, CarryingCharge; Decimal.TryParse(pRMWorkOrderEntity.AIT.ToString(), out AIT); Decimal.TryParse(pRMWorkOrderEntity.Discount.ToString(), out Discount); Decimal.TryParse(pRMWorkOrderEntity.CarryingCharge.ToString(), out CarryingCharge); Decimal.TryParse(pRMWorkOrderEntity.VAT.ToString(), out Vat); Decimal.TryParse(pRMWorkOrderEntity.Tax.ToString(), out Tax); totalPrice += AIT; totalPrice += Discount; totalPrice -= Vat; totalPrice -= Tax; totalPrice -= CarryingCharge; //lblGrandTotal.Text = Math.Round(transinfo,2).ToString(); lblGrandTotal.Text = MiscUtil.NumericCommaSeperatedFormat((Decimal)totalPrice); } } }
public IList <PRMWorkOrderItemMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <PRMWorkOrderItemMapEntity> pRMWorkOrderItemMapEntityList = new List <PRMWorkOrderItemMapEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderItemMapID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; pRMWorkOrderItemMapEntityList = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (pRMWorkOrderItemMapEntityList != null && pRMWorkOrderItemMapEntityList.Count > 0) { totalRowCount = pRMWorkOrderItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMWorkOrderItemMapEntityList ?? new List <PRMWorkOrderItemMapEntity>()); }
public IList <PRMWorkOrderItemMapEntity> GetData() { IList <PRMWorkOrderItemMapEntity> pRMWorkOrderItemMapEntityList = new List <PRMWorkOrderItemMapEntity>(); try { pRMWorkOrderItemMapEntityList = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (pRMWorkOrderItemMapEntityList != null && pRMWorkOrderItemMapEntityList.Count > 0) { totalRowCount = pRMWorkOrderItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(pRMWorkOrderItemMapEntityList ?? new List <PRMWorkOrderItemMapEntity>()); }
protected void odsREQRequisition_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { String fe = String.Empty; fe = SqlExpressionBuilder.PrepareFilterExpression("REQRequisition." + REQRequisitionEntity.FLD_NAME_RequisitionStatusID, MasterDataConstants.RequisitionStatus.APPROVED.ToString(), SQLMatchType.Equal); if (ddlProjectID != null && ddlProjectID.Items.Count > 0) { if (ddlWorkOrderID != null && ddlWorkOrderID.SelectedValue == MasterDataConstants.ItemDefaults.DEFAULT_WORKORDER.ToString()) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression("REQRequisition." + REQRequisitionEntity.FLD_NAME_ProjectID, ddlProjectID.SelectedValue.ToString(), SQLMatchType.Equal); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe1); } } if (ddlWorkOrderID != null && ddlWorkOrderID.SelectedValue != MasterDataConstants.ItemDefaults.DEFAULT_WORKORDER.ToString()) { String fe_WO = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, ddlWorkOrderID.SelectedValue.ToString(), SQLMatchType.Equal); IList <PRMWorkOrderItemMapEntity> lstPRMWorkOrderItem = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_WO, DatabaseOperationType.LoadWithFilterExpression); String compositeRequisitionID = String.Empty; if (lstPRMWorkOrderItem != null && lstPRMWorkOrderItem.Count > 0) { foreach (PRMWorkOrderItemMapEntity ent in lstPRMWorkOrderItem) { compositeRequisitionID += ent.RequisitionID + ","; } compositeRequisitionID = compositeRequisitionID.Substring(0, compositeRequisitionID.Length - 1); } String fe1 = "REQRequisition.RequisitionID in(" + compositeRequisitionID + ")"; fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe1); } if (chbxFilter.Checked) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression("REQRequisition.RequisitionNo", txtSearchText.Text.ToString(), SQLMatchType.LikeWithBothMath); fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe1); } e.InputParameters["filterExpression"] = fe; }
private void SaveWOtoACCPrePayableStatementEntity() { if (IsValid) { try { #region AccPayableStatemenet Detail IList <ACCPrePayableStatementDetailByWorkOrderNo_CustomEntity> lstACCPrePayableStatementDetail_CustomEntity = FCCACCPrePayableStatementDetailByWorkOrderNo_Custom.GetFacadeCreate().GetIL(Int64.Parse(ddlWorkOrderID.SelectedValue)); if (lstACCPrePayableStatementDetail_CustomEntity != null && lstACCPrePayableStatementDetail_CustomEntity.Count > 0) { IList <ACCPrePayableStatementDetailEntity> lstACCPrePayableStatementDetail = new List <ACCPrePayableStatementDetailEntity>(); foreach (ACCPrePayableStatementDetailByWorkOrderNo_CustomEntity entACCPrePayableStatementDetail_CustomEntity in lstACCPrePayableStatementDetail_CustomEntity) { ACCPrePayableStatementDetailEntity entACCPrePayableStatementDetail = new ACCPrePayableStatementDetailEntity(); //if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) //{ // ACCPrePayableStatementDetailEntity entTempACCPrePayableStatementDetail = (from s in lstACCPrePayableStatementDetail // where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID // // where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID && s.WorkOrderID == entACCPrePayableStatementDetail_CustomEntity.WorkOrderID // //&& s.ApprovedBillAmount == entACCPrePayableStatementDetail_CustomEntity.BillAmount && s.RequisitionID != entACCPrePayableStatementDetail_CustomEntity.RequisitionID // select s).FirstOrDefault(); // if (entTempACCPrePayableStatementDetail != null && entTempACCPrePayableStatementDetail.BillID > 0) // { // //Remove Previous Item // lstACCPrePayableStatementDetail.Remove(entTempACCPrePayableStatementDetail); // entTempACCPrePayableStatementDetail.RequisitionNo += "," + entACCPrePayableStatementDetail_CustomEntity.RequisitionNo; // //Add New Edited Item. // lstACCPrePayableStatementDetail.Add(entTempACCPrePayableStatementDetail); // continue; // } //} Decimal workOrderAgreementAmount = 0, paidAmount = 0, tDSAmount = 0, securityMoney = 0, billAmount = 0; entACCPrePayableStatementDetail.PrePayableStatementID = ACCPrePayableStatementID; if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.IsNotNullOrEmpty()) { entACCPrePayableStatementDetail.WorkOrderNo = entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.Trim(); } else { entACCPrePayableStatementDetail.WorkOrderNo = null; } if (entACCPrePayableStatementDetail_CustomEntity.WOAmount.HasValue) { workOrderAgreementAmount = Decimal.Parse(entACCPrePayableStatementDetail_CustomEntity.WOAmount.ToString()); entACCPrePayableStatementDetail.WorkOrderAmount = workOrderAgreementAmount; } else { entACCPrePayableStatementDetail.WorkOrderAmount = null; } if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderID > 0) { entACCPrePayableStatementDetail.WorkOrderID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.WorkOrderID.ToString()); } else { entACCPrePayableStatementDetail.WorkOrderID = null; } if (entACCPrePayableStatementDetail_CustomEntity.StartDate != null) { entACCPrePayableStatementDetail.WorkOrderDate = entACCPrePayableStatementDetail_CustomEntity.StartDate; } else { entACCPrePayableStatementDetail.WorkOrderDate = null; } Decimal payableAgainstWO = (workOrderAgreementAmount - paidAmount - tDSAmount); //Decimal netPayableConsideringBillSecurity = (billAmount - paidAmount - securityMoney - tDSAmount); //need to discuss with Rayan vaiya. To get value from formula or anywhere else??? Decimal netPayableConsideringBillSecurity = payableAgainstWO; entACCPrePayableStatementDetail.PaidAmount = paidAmount; entACCPrePayableStatementDetail.SecurityMoney = securityMoney; entACCPrePayableStatementDetail.TDSAmount = tDSAmount; entACCPrePayableStatementDetail.PayableAgainstWorkOrder = payableAgainstWO; entACCPrePayableStatementDetail.NetPayableConsideringBillAndSecurity = netPayableConsideringBillSecurity; entACCPrePayableStatementDetail.CreateDate = System.DateTime.Now; entACCPrePayableStatementDetail.ApprovedBillAmount = 0; entACCPrePayableStatementDetail.PartyReconcile = false; Int64 requisitionID = 0; Int64 projectID = 0; String projectCode = null; String requisitionNo = null; DateTime requisitionDate = System.DateTime.Now; if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderID > 0) { String fe_WOItemMap = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, entACCPrePayableStatementDetail_CustomEntity.WorkOrderID.ToString(), SQLMatchType.Equal); IList <PRMWorkOrderItemMapEntity> lstWOItemMap = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_WOItemMap, DatabaseOperationType.LoadWithFilterExpression); if (lstWOItemMap != null && lstWOItemMap.Count > 0) { var distinctTypeIDs = lstWOItemMap.Select(x => x.RequisitionID).Distinct(); foreach (var ent in distinctTypeIDs) { String fe_requisition = SqlExpressionBuilder.PrepareFilterExpression("REQRequisition." + REQRequisitionEntity.FLD_NAME_RequisitionID, ent.ToString(), SQLMatchType.Equal); IList <REQRequisition_DetailedEntity> lstReqRequisition_detailed = FCCREQRequisition_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_requisition); if (lstReqRequisition_detailed != null && lstReqRequisition_detailed.Count > 0) { requisitionID = lstReqRequisition_detailed[0].RequisitionID; projectCode = lstReqRequisition_detailed[0].ProjectCode; requisitionNo += lstReqRequisition_detailed[0].RequisitionNo + " "; requisitionDate = lstReqRequisition_detailed[0].RequisitionDate; projectID = lstReqRequisition_detailed[0].ProjectID; } } } } entACCPrePayableStatementDetail.RequisitionID = requisitionID; entACCPrePayableStatementDetail.RequisitionNo = requisitionNo; entACCPrePayableStatementDetail.RequisitionDate = requisitionDate; entACCPrePayableStatementDetail.ProjectID = projectID; entACCPrePayableStatementDetail.ProjectCode = projectCode; //REQRequisitionEntity reqRequisitionEntity = null; //if (entACCPrePayableStatementDetail_CustomEntity.RequisitionID > 0) //{ // entACCPrePayableStatementDetail.RequisitionID = entACCPrePayableStatementDetail_CustomEntity.RequisitionID; // reqRequisitionEntity = FCCREQRequisition.GetFacadeCreate().GetByID(entACCPrePayableStatementDetail_CustomEntity.RequisitionID); // if (reqRequisitionEntity != null) // { // entACCPrePayableStatementDetail.RequisitionNo = reqRequisitionEntity.RequisitionNo; ; // entACCPrePayableStatementDetail.RequisitionDate = reqRequisitionEntity.RequisitionDate; // entACCPrePayableStatementDetail.ProjectID = reqRequisitionEntity.ProjectID; // Project ID should come from the first requisition Project ID. // } //} //else //{ // entACCPrePayableStatementDetail.RequisitionID = null; //} //if (entACCPrePayableStatementDetail_CustomEntity.RequisitionNo.IsNotNullOrEmpty()) //{ // entACCPrePayableStatementDetail.RequisitionNo = entACCPrePayableStatementDetail_CustomEntity.RequisitionNo; //} //else //{ // entACCPrePayableStatementDetail.RequisitionNo = null; //} //if (entACCPrePayableStatementDetail_CustomEntity.RequisitionDate.HasValue) //{ // entACCPrePayableStatementDetail.RequisitionDate = entACCPrePayableStatementDetail_CustomEntity.RequisitionDate; //} //else //{ // entACCPrePayableStatementDetail.RequisitionDate = null; //} //entACCPrePayableStatementDetail.ProjectID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.ProjectID.ToString()); entACCPrePayableStatementDetail.BillID = null; entACCPrePayableStatementDetail.BillDate = null; entACCPrePayableStatementDetail.BillNo = null; entACCPrePayableStatementDetail.VendorCategoryID = MasterDataConstants.MDVendorCategory.VENDOR; entACCPrePayableStatementDetail.FromVendorID = entACCPrePayableStatementDetail_CustomEntity.SupplierID; entACCPrePayableStatementDetail.CreateByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember); entACCPrePayableStatementDetail.Ref = null; entACCPrePayableStatementDetail.DueDate = DateTime.Now; entACCPrePayableStatementDetail.PlannedDate = null; entACCPrePayableStatementDetail.Remarks = null; entACCPrePayableStatementDetail.AdditionalRemarks = null; entACCPrePayableStatementDetail.ACCPayablePaymentStatusID = MasterDataConstants.MDACCPayablePaymentStatus.CURRENT; entACCPrePayableStatementDetail.ACCPayableApprovalStatusID = MasterDataConstants.ACCPrePayableStatementApprovalStatus.INITIATED; entACCPrePayableStatementDetail.AccountPaybleStatementDetailCategoryID = MasterDataConstants.MDAccountPaybleStatementDetailCategory.REGULAR; entACCPrePayableStatementDetail.PayableClassificationID = MasterDataConstants.MDPayableClassification.AS; entACCPrePayableStatementDetail.APPanelID = MasterDataConstants.DeafultAPPanel.DEFAULT_AP_PANEL; entACCPrePayableStatementDetail.IsRemoved = false; entACCPrePayableStatementDetail.IsLocked = false; lstACCPrePayableStatementDetail.Add(entACCPrePayableStatementDetail); break; } #region Insert To Payable Detail if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) { foreach (ACCPrePayableStatementDetailEntity ent in lstACCPrePayableStatementDetail) { FCCACCPrePayableStatementDetail.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No); } } #endregion MiscUtil.ShowMessage(lblMessage, "Pre Payable Statement Information has been added successfully.", false); } #endregion _PrePayableStatementID = 0; _ACCPrePayableStatementEntity = new ACCPrePayableStatementEntity(); PrepareInitialView(); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void SaveACCPrePayableStatementEntity() { if (IsValid) { try { ACCPrePayableStatementEntity aCCPrePayableStatementEntity = BuildACCPrePayableStatementEntity(); Int64 result = -1; if (aCCPrePayableStatementEntity.IsNew) { result = FCCACCPrePayableStatement.GetFacadeCreate().Add(aCCPrePayableStatementEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACCPrePayableStatementEntity.FLD_NAME_PrePayableStatementID, aCCPrePayableStatementEntity.PrePayableStatementID.ToString(), SQLMatchType.Equal); result = FCCACCPrePayableStatement.GetFacadeCreate().Update(aCCPrePayableStatementEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { #region AccPayableStatemenet Detail From Bill IList <ACCPrePayableStatementDetail_CustomEntity> lstACCPrePayableStatementDetail_CustomEntity = FCCACCPrePayableStatementDetail_Custom.GetFacadeCreate().GetIL(aCCPrePayableStatementEntity.StartDate, aCCPrePayableStatementEntity.EndDate); if (lstACCPrePayableStatementDetail_CustomEntity != null && lstACCPrePayableStatementDetail_CustomEntity.Count > 0) { IList <ACCPrePayableStatementDetailEntity> lstACCPrePayableStatementDetail = new List <ACCPrePayableStatementDetailEntity>(); foreach (ACCPrePayableStatementDetail_CustomEntity entACCPrePayableStatementDetail_CustomEntity in lstACCPrePayableStatementDetail_CustomEntity) { ACCPrePayableStatementDetailEntity entACCPrePayableStatementDetail = new ACCPrePayableStatementDetailEntity(); if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) { ACCPrePayableStatementDetailEntity entTempACCPrePayableStatementDetail = (from s in lstACCPrePayableStatementDetail where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID && s.WorkOrderID == entACCPrePayableStatementDetail_CustomEntity.WorkOrderID //where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID && s.WorkOrderID == entACCPrePayableStatementDetail_CustomEntity.WorkOrderID //&& s.ApprovedBillAmount == entACCPrePayableStatementDetail_CustomEntity.BillAmount && s.RequisitionID == entACCPrePayableStatementDetail_CustomEntity.RequisitionID select s).FirstOrDefault(); if (entTempACCPrePayableStatementDetail != null && entTempACCPrePayableStatementDetail.BillID > 0) { //Remove Previous Item lstACCPrePayableStatementDetail.Remove(entTempACCPrePayableStatementDetail); ///Clear this list................................ entTempACCPrePayableStatementDetail.RequisitionNo += "," + entACCPrePayableStatementDetail_CustomEntity.RequisitionNo; //Add New Edited Item. lstACCPrePayableStatementDetail.Add(entTempACCPrePayableStatementDetail); continue; } } //else if(Flag) //{ Decimal workOrderAgreementAmount = 0, paidAmount = 0, tDSAmount = 0, securityMoney = 0, billamount = 0; Decimal.TryParse(entACCPrePayableStatementDetail_CustomEntity.BillAmount.ToString(), out billamount); entACCPrePayableStatementDetail.PrePayableStatementID = result; if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.IsNotNullOrEmpty()) { entACCPrePayableStatementDetail.WorkOrderNo = entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.Trim(); } else { entACCPrePayableStatementDetail.WorkOrderNo = null; } if (entACCPrePayableStatementDetail_CustomEntity.WOAmount.HasValue) { workOrderAgreementAmount = Decimal.Parse(entACCPrePayableStatementDetail_CustomEntity.WOAmount.ToString()); entACCPrePayableStatementDetail.WorkOrderAmount = workOrderAgreementAmount; } else { entACCPrePayableStatementDetail.WorkOrderAmount = null; } if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderID > 0) { entACCPrePayableStatementDetail.WorkOrderID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.WorkOrderID.ToString()); } else { entACCPrePayableStatementDetail.WorkOrderID = null; } if (entACCPrePayableStatementDetail_CustomEntity.StartDate.HasValue) { entACCPrePayableStatementDetail.WorkOrderDate = entACCPrePayableStatementDetail_CustomEntity.StartDate; } else { entACCPrePayableStatementDetail.WorkOrderDate = null; } Decimal payableAgainstWO = (workOrderAgreementAmount - paidAmount - tDSAmount); Decimal netPayableConsideringBillSecurity = (billamount - paidAmount - securityMoney - tDSAmount); entACCPrePayableStatementDetail.PaidAmount = paidAmount; entACCPrePayableStatementDetail.SecurityMoney = securityMoney; entACCPrePayableStatementDetail.TDSAmount = tDSAmount; entACCPrePayableStatementDetail.PayableAgainstWorkOrder = payableAgainstWO; entACCPrePayableStatementDetail.NetPayableConsideringBillAndSecurity = netPayableConsideringBillSecurity; entACCPrePayableStatementDetail.CreateDate = System.DateTime.Now; //if (!txtSecurityMoneyLV.Text.Trim().IsNullOrEmpty()) //{ // aCCPrePayableStatementDetailEntity.SecurityMoney = Decimal.Parse(txtSecurityMoneyLV.Text.Trim()); //} //else //{ // aCCPrePayableStatementDetailEntity.SecurityMoney = null; //} //if (!txtTDSAmountLV.Text.Trim().IsNullOrEmpty()) //{ // aCCPrePayableStatementDetailEntity.TDSAmount = Decimal.Parse(txtTDSAmountLV.Text.Trim()); //} //else //{ // aCCPrePayableStatementDetailEntity.TDSAmount = null; //} //if (!txtPayableAgainstWorkOrderLV.Text.Trim().IsNullOrEmpty()) //{ // aCCPrePayableStatementDetailEntity.PayableAgainstWorkOrder = Decimal.Parse(txtPayableAgainstWorkOrderLV.Text.Trim()); //} //else //{ // aCCPrePayableStatementDetailEntity.PayableAgainstWorkOrder = null; //} if (entACCPrePayableStatementDetail_CustomEntity.BillAmount.HasValue) { entACCPrePayableStatementDetail.ApprovedBillAmount = Decimal.Parse(entACCPrePayableStatementDetail_CustomEntity.BillAmount.ToString()); } else { entACCPrePayableStatementDetail.ApprovedBillAmount = null; } //if (!txtNetPayableConsideringBillAndSecurityLV.Text.Trim().IsNullOrEmpty()) //{ // aCCPrePayableStatementDetailEntity.NetPayableConsideringBillAndSecurity = Decimal.Parse(txtNetPayableConsideringBillAndSecurityLV.Text.Trim()); //} //else //{ // aCCPrePayableStatementDetailEntity.NetPayableConsideringBillAndSecurity = null; //} entACCPrePayableStatementDetail.PartyReconcile = false; if (entACCPrePayableStatementDetail_CustomEntity.RequisitionID > 0) { entACCPrePayableStatementDetail.RequisitionID = entACCPrePayableStatementDetail_CustomEntity.RequisitionID; } else { entACCPrePayableStatementDetail.RequisitionID = null; } if (entACCPrePayableStatementDetail_CustomEntity.RequisitionNo.IsNotNullOrEmpty()) { entACCPrePayableStatementDetail.RequisitionNo = entACCPrePayableStatementDetail_CustomEntity.RequisitionNo; } else { entACCPrePayableStatementDetail.RequisitionNo = null; } if (entACCPrePayableStatementDetail_CustomEntity.RequisitionDate.HasValue) { entACCPrePayableStatementDetail.RequisitionDate = entACCPrePayableStatementDetail_CustomEntity.RequisitionDate; } else { entACCPrePayableStatementDetail.RequisitionDate = null; } entACCPrePayableStatementDetail.ProjectID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.ProjectID.ToString()); entACCPrePayableStatementDetail.BillID = entACCPrePayableStatementDetail_CustomEntity.BillID; entACCPrePayableStatementDetail.BillDate = entACCPrePayableStatementDetail_CustomEntity.billlDate; entACCPrePayableStatementDetail.BillNo = entACCPrePayableStatementDetail_CustomEntity.BillNo; entACCPrePayableStatementDetail.VendorCategoryID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.VendorCategory.ToString()); entACCPrePayableStatementDetail.FromVendorID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.Vendor.ToString()); entACCPrePayableStatementDetail.CreateByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember); entACCPrePayableStatementDetail.Ref = null; entACCPrePayableStatementDetail.DueDate = DateTime.Now; entACCPrePayableStatementDetail.PlannedDate = null; entACCPrePayableStatementDetail.Remarks = null; entACCPrePayableStatementDetail.AdditionalRemarks = null; entACCPrePayableStatementDetail.ACCPayablePaymentStatusID = MasterDataConstants.MDACCPayablePaymentStatus.CURRENT; entACCPrePayableStatementDetail.ACCPayableApprovalStatusID = MasterDataConstants.ACCPrePayableStatementApprovalStatus.INITIATED; entACCPrePayableStatementDetail.AccountPaybleStatementDetailCategoryID = MasterDataConstants.MDAccountPaybleStatementDetailCategory.REGULAR; entACCPrePayableStatementDetail.PayableClassificationID = MasterDataConstants.MDPayableClassification.AS; entACCPrePayableStatementDetail.APPanelID = MasterDataConstants.DeafultAPPanel.DEFAULT_AP_PANEL; entACCPrePayableStatementDetail.IsRemoved = false; entACCPrePayableStatementDetail.IsLocked = false; lstACCPrePayableStatementDetail.Add(entACCPrePayableStatementDetail); //} } #region AccPayableStatemenet Detail IList <ACCPrePayableStatementDetailFromWO_CustomEntity> lstACCPrePayableStatementDetailFromWO_CustomEntity = FCCACCPrePayableStatementDetailFromWO_Custom.GetFacadeCreate().GetIL(); if (lstACCPrePayableStatementDetailFromWO_CustomEntity != null && lstACCPrePayableStatementDetailFromWO_CustomEntity.Count > 0) { foreach (ACCPrePayableStatementDetailFromWO_CustomEntity entACCPrePayableStatementDetail_CustomEntity in lstACCPrePayableStatementDetailFromWO_CustomEntity) { ACCPrePayableStatementDetailEntity entACCPrePayableStatementDetail = new ACCPrePayableStatementDetailEntity(); //if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) //{ // ACCPrePayableStatementDetailEntity entTempACCPrePayableStatementDetail = (from s in lstACCPrePayableStatementDetail // where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID // // where s.BillID == entACCPrePayableStatementDetail_CustomEntity.BillID && s.WorkOrderID == entACCPrePayableStatementDetail_CustomEntity.WorkOrderID // //&& s.ApprovedBillAmount == entACCPrePayableStatementDetail_CustomEntity.BillAmount && s.RequisitionID != entACCPrePayableStatementDetail_CustomEntity.RequisitionID // select s).FirstOrDefault(); // if (entTempACCPrePayableStatementDetail != null && entTempACCPrePayableStatementDetail.BillID > 0) // { // //Remove Previous Item // lstACCPrePayableStatementDetail.Remove(entTempACCPrePayableStatementDetail); // entTempACCPrePayableStatementDetail.RequisitionNo += "," + entACCPrePayableStatementDetail_CustomEntity.RequisitionNo; // //Add New Edited Item. // lstACCPrePayableStatementDetail.Add(entTempACCPrePayableStatementDetail); // continue; // } //} Decimal workOrderAgreementAmount = 0, paidAmount = 0, tDSAmount = 0, securityMoney = 0, billAmount = 0; entACCPrePayableStatementDetail.PrePayableStatementID = result; if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.IsNotNullOrEmpty()) { entACCPrePayableStatementDetail.WorkOrderNo = entACCPrePayableStatementDetail_CustomEntity.WorkOrderNo.Trim(); } else { entACCPrePayableStatementDetail.WorkOrderNo = null; } if (entACCPrePayableStatementDetail_CustomEntity.WOAmount.HasValue) { workOrderAgreementAmount = Decimal.Parse(entACCPrePayableStatementDetail_CustomEntity.WOAmount.ToString()); entACCPrePayableStatementDetail.WorkOrderAmount = workOrderAgreementAmount; } else { entACCPrePayableStatementDetail.WorkOrderAmount = null; } if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderID > 0) { entACCPrePayableStatementDetail.WorkOrderID = Int64.Parse(entACCPrePayableStatementDetail_CustomEntity.WorkOrderID.ToString()); } else { entACCPrePayableStatementDetail.WorkOrderID = null; } if (entACCPrePayableStatementDetail_CustomEntity.StartDate != null) { entACCPrePayableStatementDetail.WorkOrderDate = entACCPrePayableStatementDetail_CustomEntity.StartDate; } else { entACCPrePayableStatementDetail.WorkOrderDate = null; } Decimal payableAgainstWO = (workOrderAgreementAmount - paidAmount - tDSAmount); //Decimal netPayableConsideringBillSecurity = (billAmount - paidAmount - securityMoney - tDSAmount); //need to discuss with Rayan vaiya. To get value from formula or anywhere else??? Decimal netPayableConsideringBillSecurity = payableAgainstWO; entACCPrePayableStatementDetail.PaidAmount = paidAmount; entACCPrePayableStatementDetail.SecurityMoney = securityMoney; entACCPrePayableStatementDetail.TDSAmount = tDSAmount; entACCPrePayableStatementDetail.PayableAgainstWorkOrder = payableAgainstWO; entACCPrePayableStatementDetail.NetPayableConsideringBillAndSecurity = netPayableConsideringBillSecurity; entACCPrePayableStatementDetail.CreateDate = System.DateTime.Now; entACCPrePayableStatementDetail.ApprovedBillAmount = 0; entACCPrePayableStatementDetail.PartyReconcile = false; Int64 requisitionID = 0; Int64 projectID = 0; String projectCode = null; String requisitionNo = null; DateTime requisitionDate = System.DateTime.Now; if (entACCPrePayableStatementDetail_CustomEntity.WorkOrderID > 0) { String fe_WOItemMap = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, entACCPrePayableStatementDetail_CustomEntity.WorkOrderID.ToString(), SQLMatchType.Equal); IList <PRMWorkOrderItemMapEntity> lstWOItemMap = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_WOItemMap, DatabaseOperationType.LoadWithFilterExpression); if (lstWOItemMap != null && lstWOItemMap.Count > 0) { var distinctTypeIDs = lstWOItemMap.Select(x => x.RequisitionID).Distinct(); foreach (var ent in distinctTypeIDs) { String fe_requisition = SqlExpressionBuilder.PrepareFilterExpression("REQRequisition." + REQRequisitionEntity.FLD_NAME_RequisitionID, ent.ToString(), SQLMatchType.Equal); IList <REQRequisition_DetailedEntity> lstReqRequisition_detailed = FCCREQRequisition_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_requisition); if (lstReqRequisition_detailed != null && lstReqRequisition_detailed.Count > 0) { requisitionID = lstReqRequisition_detailed[0].RequisitionID; projectCode = lstReqRequisition_detailed[0].ProjectCode; requisitionNo += lstReqRequisition_detailed[0].RequisitionNo + " "; requisitionDate = lstReqRequisition_detailed[0].RequisitionDate; projectID = lstReqRequisition_detailed[0].ProjectID; } } } } entACCPrePayableStatementDetail.RequisitionID = requisitionID; entACCPrePayableStatementDetail.RequisitionNo = requisitionNo; entACCPrePayableStatementDetail.RequisitionDate = requisitionDate; entACCPrePayableStatementDetail.ProjectID = projectID; entACCPrePayableStatementDetail.ProjectCode = projectCode; entACCPrePayableStatementDetail.BillID = null; entACCPrePayableStatementDetail.BillDate = null; entACCPrePayableStatementDetail.BillNo = null; entACCPrePayableStatementDetail.VendorCategoryID = MasterDataConstants.MDVendorCategory.VENDOR; entACCPrePayableStatementDetail.FromVendorID = entACCPrePayableStatementDetail_CustomEntity.SupplierID; entACCPrePayableStatementDetail.CreateByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember); entACCPrePayableStatementDetail.Ref = null; entACCPrePayableStatementDetail.DueDate = DateTime.Now; entACCPrePayableStatementDetail.PlannedDate = null; entACCPrePayableStatementDetail.Remarks = null; entACCPrePayableStatementDetail.AdditionalRemarks = null; entACCPrePayableStatementDetail.ACCPayablePaymentStatusID = MasterDataConstants.MDACCPayablePaymentStatus.CURRENT; entACCPrePayableStatementDetail.ACCPayableApprovalStatusID = MasterDataConstants.ACCPrePayableStatementApprovalStatus.INITIATED; entACCPrePayableStatementDetail.AccountPaybleStatementDetailCategoryID = MasterDataConstants.MDAccountPaybleStatementDetailCategory.REGULAR; entACCPrePayableStatementDetail.PayableClassificationID = MasterDataConstants.MDPayableClassification.AS; entACCPrePayableStatementDetail.APPanelID = MasterDataConstants.DeafultAPPanel.DEFAULT_AP_PANEL; entACCPrePayableStatementDetail.IsRemoved = false; entACCPrePayableStatementDetail.IsLocked = false; lstACCPrePayableStatementDetail.Add(entACCPrePayableStatementDetail); } //#region Insert To Payable Detail //if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) //{ // foreach (ACCPrePayableStatementDetailEntity ent in lstACCPrePayableStatementDetail) // { // FCCACCPrePayableStatementDetail.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No); // } //} //#endregion //MiscUtil.ShowMessage(lblMessage, "Pre Payable Statement Information has been added successfully.", false); } #endregion #region Insert To Payable Detail if (lstACCPrePayableStatementDetail != null && lstACCPrePayableStatementDetail.Count > 0) { foreach (ACCPrePayableStatementDetailEntity ent in lstACCPrePayableStatementDetail) { FCCACCPrePayableStatementDetail.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No); } } #endregion } #endregion _PrePayableStatementID = 0; _ACCPrePayableStatementEntity = new ACCPrePayableStatementEntity(); PrepareInitialView(); BindACCPrePayableStatementList(); String navUrl = UrlHelper.BuildSecureUrl("~/ACC/ACCPrePayableStatementDetail.aspx", string.Empty, UrlConstants.OVERVIEW_PRE_PAYABLE_STATEMENT_ID, result.ToString()).ToString(); Response.Redirect(navUrl); if (aCCPrePayableStatementEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Pre Payable Statement Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Pre Payable Statement Information has been updated successfully.", false); } } else { if (aCCPrePayableStatementEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Pre Payable Statement Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Pre Payable Statement Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void PrepareEditView() { PRMWorkOrderEntity pRMWorkOrderEntity = CurrentPRMWorkOrderEntity; if (!pRMWorkOrderEntity.IsNew) { if (ddlSupplierID.Items.Count > 0 && pRMWorkOrderEntity.SupplierID != null) { ddlSupplierID.SelectedValue = pRMWorkOrderEntity.SupplierID.ToString(); } PopulatePRMSupplierContactPersonByVedor(); txtWorkOrderNo.Text = pRMWorkOrderEntity.WorkOrderNo.ToString(); if (ddlAttentionID.Items.Count > 0 && pRMWorkOrderEntity.AttentionID != null) { ddlAttentionID.SelectedValue = pRMWorkOrderEntity.AttentionID.ToString(); pnlOtherAttention.Visible = false; } if (ddlAttentionID.Items.Count > 0 && pRMWorkOrderEntity.AttentionID == null) { ddlAttentionID.SelectedValue = "0"; pnlOtherAttention.Visible = true; } txtOtherAttention.Text = pRMWorkOrderEntity.OtherAttention.ToString(); txtCreateDate.Text = pRMWorkOrderEntity.CreateDate.ToStringDefault(); txtSubject.Text = pRMWorkOrderEntity.Subject.ToString(); txtBodyTitle.Text = pRMWorkOrderEntity.BodyTitle.ToString(); txtStartDate.Text = pRMWorkOrderEntity.StartDate.ToStringDefault(); txtCompletionDate.Text = pRMWorkOrderEntity.CompletionDate.ToStringDefault(); txtWarranty.Text = pRMWorkOrderEntity.Warranty.ToString(); txtDelayCharge.Text = pRMWorkOrderEntity.DelayCharge.ToString(); txtAIT.Text = pRMWorkOrderEntity.AIT.ToString(); txtCarryingCharge.Text = pRMWorkOrderEntity.CarryingCharge.ToString(); txtDiscount.Text = pRMWorkOrderEntity.Discount.ToString(); txtVAT.Text = pRMWorkOrderEntity.VAT.ToString(); txtTax.Text = pRMWorkOrderEntity.Tax.ToString(); String fe_workorderItem = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, pRMWorkOrderEntity.WorkOrderID.ToString(), SQLMatchType.Equal); IList <PRMWorkOrderItemMapEntity> lstPRMWorkOrderItemMap = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_workorderItem, DatabaseOperationType.LoadWithFilterExpression); if (lstPRMWorkOrderItemMap != null && lstPRMWorkOrderItemMap.Count > 0) { txtTotal.Text = Math.Round(lstPRMWorkOrderItemMap.Sum(o => (o.RequiredQty * o.Rate)), 2).ToString(); } else { txtTotal.Text = "0"; } if (txtTotal.Text.Trim().IsNotNullOrEmpty()) { Decimal total, ait, vat, tax, discount, carryingcharge, netAmount; Decimal.TryParse(txtTotal.Text.Trim(), out total); Decimal.TryParse(txtAIT.Text.Trim(), out ait); Decimal.TryParse(txtVAT.Text.Trim(), out vat); Decimal.TryParse(txtTax.Text.Trim(), out tax); Decimal.TryParse(txtDiscount.Text.Trim(), out discount); Decimal.TryParse(txtCarryingCharge.Text.Trim(), out carryingcharge); netAmount = total - discount + carryingcharge + vat + tax; txtGrandTotal.Text = Math.Round(netAmount, 2).ToString(); } else { txtGrandTotal.Text = "0"; } txtRowText.Text = pRMWorkOrderEntity.RowText.ToString(); txtRemarks.Text = pRMWorkOrderEntity.Remarks.ToString(); txtFootNote.Text = pRMWorkOrderEntity.FootNote.ToString(); if (ddlPreparedByID.Items.Count > 0 && pRMWorkOrderEntity.PreparedByID != null) { ddlPreparedByID.SelectedValue = pRMWorkOrderEntity.PreparedByID.ToString(); } if (ddlWorkOrderStatusID.Items.Count > 0 && pRMWorkOrderEntity.WorkOrderStatusID != null) { ddlWorkOrderStatusID.SelectedValue = pRMWorkOrderEntity.WorkOrderStatusID.ToString(); } btnSubmit.Text = "Update"; btnAddNew.Visible = true; } }