public async Task <IActionResult> OnGetAsync(int id) { ReceiptInvoice = await Context.ReceiptInvoice.Include(c => c.Client).Include(v => v.Vendor).FirstOrDefaultAsync(m => m.ReceiptInvoiceID == id); if (ReceiptInvoice == null) { return(NotFound()); } ViewData["ClientID"] = new SelectList(Context.Client, "ID", "ID"); ViewData["VendorID"] = new SelectList(Context.Vendor, "ID", "ID"); var isAuthorized = await AuthorizationService.AuthorizeAsync( User, ReceiptInvoice, EmployeeOperations.Update); if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } PopulateRecieverDropDownList(Context, ReceiptInvoice.ClientID); PopulateReciever2DropDownList(Context, ReceiptInvoice.VendorID); return(Page()); }
private void Button_Click_1(object sender, RoutedEventArgs e) { int Item_Id = int.Parse(ItemCombo.SelectedValue.ToString()); var SelectItem = context.Items.Where(item => item.ID == Item_Id).FirstOrDefault(); int No = int.Parse(NoOfInvoice.Text); ReceiptInvoice CurrentEdit = context.ReceiptInvoices.Where(recip => recip.ID == No).FirstOrDefault(); ItemInReceiptInvoice CurrentEditQuan = context.ItemInReceiptInvoices.Where(recip => recip.ReceiptInvoice_Id == CurrentEdit.ID && recip.Item_Id == Item_Id).FirstOrDefault(); if (CurrentEdit == null) { return; } SelectItem.Quantity += CurrentEditQuan.Quantity; CurrentEditQuan.Quantity = int.Parse(Quantity.Text); SelectItem.Quantity -= CurrentEditQuan.Quantity; ListViewRecipt Row = ListView.SelectedItem as ListViewRecipt; if (Row == null) { return; } SubtractTotal(Row.Quantity, Row.PriceForPiece); Row.Quantity = int.Parse(Quantity.Text); ListView.Items.Remove(ListView.SelectedItem); Total.Text = calculateTotal(Row.Quantity, Row.PriceForPiece).ToString(); Row.TotalPrice = Row.Quantity * Row.PriceForPiece; CategoryCombo.IsEnabled = true; ItemCombo.IsEnabled = true; ListView.Items.Add(Row); context.SaveChanges(); }
public ReceiptInvoice CreateFakeInvoice(PO po,int IDPrinted,int userID) { ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = po.ID; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = po.StoreID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.InvoiceTypeID = InvoiceType.Internal; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.ActivityID = po.StoreID; rctInvoice.SavedByUserID = CurrentContext.LoggedInUser.ID; rctInvoice.IsDeliveryNote = false; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.PrintedDate = DateTime.Now; rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.Save(); return rctInvoice; }
public async Task <IActionResult> OnPostAsync(int id) { // PaymentInvoice = await Context.PaymentInvoice.FindAsync(id); ReceiptInvoice = await Context.ReceiptInvoice.AsNoTracking() .FirstOrDefaultAsync(m => m.ReceiptInvoiceID == id); var receiptInvoice = await Context .ReceiptInvoice.AsNoTracking() .FirstOrDefaultAsync(m => m.ReceiptInvoiceID == id); if (receiptInvoice == null) { return(NotFound()); } var isAuthorized = await AuthorizationService.AuthorizeAsync( User, receiptInvoice, EmployeeOperations.Delete); if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } Context.ReceiptInvoice.Remove(ReceiptInvoice); await Context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public Receipt CreateFakeReceipt(int receiptTypeID, ReceiptInvoice rctInvoice, int userId, int receiptStatusID, int wearehouse = 0) { Receipt receipt = new Receipt(); receipt.AddNew(); receipt.DateOfEntry = DateTimeHelper.ServerDateTime; receipt.ReceiptTypeID = receiptTypeID; receipt.ReceiptTypeID = receiptTypeID; receipt.SavedByUserID = userId; receipt.WarehouseID = wearehouse; receipt.ReceiptInvoiceID = rctInvoice.ID; receipt.STVOrInvoiceNo = rctInvoice.STVOrInvoiceNo; receipt.SavedByUserID = userId; if (receipt.IsColumnNull("TransitTransferNo")) { receipt.TransitTransferNo = rctInvoice.TransitTransferNo; } receipt.InsurancePolicyNo = rctInvoice.InsurancePolicyNo; receipt.WayBillNo = rctInvoice.WayBillNo; receipt.ReceiptStatusID = receiptStatusID; receipt.Save(); return(receipt); }
public ReceiptInvoice CreateFakeInvoice(PO po, int IDPrinted, int userID) { ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = po.ID; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = po.StoreID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.InvoiceTypeID = InvoiceType.Internal; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.ActivityID = po.StoreID; rctInvoice.SavedByUserID = CurrentContext.LoggedInUser.ID; rctInvoice.IsDeliveryNote = false; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.PrintedDate = DateTime.Now; rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.Save(); return(rctInvoice); }
private void gridInvoiceDetailView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e != null && e.Column.FieldName == "InvoiceCost") { DataRow drv = gridInvoiceDetailView.GetFocusedDataRow(); // receipt.SaveFOBForEachReceiveDoc(); var receipt = new BLL.Receipt(Convert.ToInt32(drv["ReceiptID"])); var receiptInvoice = new ReceiptInvoice(receipt.ReceiptInvoiceID); var po = new BLL.PO(receiptInvoice.POID); if (po.IsElectronic) { var originalInvoiceCost = Convert.ToDecimal(drv["OriginalInvoiceCost"]); var newInvoiceCost = Convert.ToDecimal(drv["InvoiceCost"]); if (newInvoiceCost != originalInvoiceCost) { drv["InvoiceCost"] = originalInvoiceCost; XtraMessageBox.Show("You are trying to change the Invoice Cost set by Center. Please enter the correct cost!", "Invoice Cost Not Similar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (drv["InvoiceCost"] != DBNull.Value) { PricePerPackPage PricingForm = new PricePerPackPage(ReceiptID, Convert.ToInt32(drv["ItemID"]), Convert.ToInt32(drv["ItemUnitID"]), Convert.ToInt32(drv["ManufacturerID"]), Convert.ToInt32(drv["ActivityID"]), Convert.ToDouble(drv["InvoiceCost"])); PricingForm.ShowDialog(this); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); } } else if (e != null && e.Column.FieldName == "Margin") { DataRow drv = gridInvoiceDetailView.GetFocusedDataRow(); // receipt.SaveFOBForEachReceiveDoc(); var receipt = new BLL.Receipt(Convert.ToInt32(drv["ReceiptID"])); var receiptInvoice = new ReceiptInvoice(receipt.ReceiptInvoiceID); var po = new BLL.PO(receiptInvoice.POID); var item = new Item(); item.LoadByPrimaryKey(Convert.ToInt32(drv["ItemID"])); if (po.IsElectronic && !item.IsVariableMargin) { var originalMargin = Convert.ToDecimal(drv["OriginalMargin"]); var newMargin = Convert.ToDecimal(drv["Margin"]); if (newMargin != originalMargin) { drv["Margin"] = originalMargin; XtraMessageBox.Show("You are trying to change the Margin set by Center. Please enter the correct Margin!", "Margin Not Similar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (drv["Margin"] != DBNull.Value) { MarginPage MarginForm = new MarginPage(ReceiptID, Convert.ToInt32(drv["ItemID"]), Convert.ToInt32(drv["ItemUnitID"]), Convert.ToInt32(drv["ManufacturerID"]), Convert.ToInt32(drv["ActivityID"]), Convert.ToDouble(drv["Margin"])); MarginForm.ShowDialog(this); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); } } }
public ReceiptInvoice CreateInvoice(salesman salesman) { ReceiptInvoice recipt = new ReceiptInvoice() { Date = DateTime.Now, salesman = salesman, ItemInReceiptInvoices = new List <ItemInReceiptInvoice>() }; return(recipt); }
private void btnInvoice_Click(object sender, EventArgs e) { BLL.Receipt GRV = new BLL.Receipt(); GRV.LoadByPrimaryKey(ReceiptID); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); ReceiptInvoiceDialog InvoiceDialog = new ReceiptInvoiceDialog(invoice.POID, invoice.ID); InvoiceDialog.ShowDialog(); LoadSelectedGRVDetailForCostBuildUp(ReceiptID); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } ReceiptInvoice.UploadDT = DateTime.Now; ReceiptInvoice.OwnerID = UserManager.GetUserId(User); // requires using ContactManager.Authorization; var isAuthorized = await AuthorizationService.AuthorizeAsync( User, ReceiptInvoice, EmployeeOperations.Create); if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } var emptyReceiptInvoice = new ReceiptInvoice(); if (await TryUpdateModelAsync <ReceiptInvoice>( emptyReceiptInvoice, "receiptinvoice", // Prefix for form value. s => s.ReceiptInvoiceID, s => s.RecieverType, s => s.ClientID, s => s.VendorID, s => s.Amount, s => s.PaymentType, s => s.ImageName)) { if (Image != null) { var fileName = GetUniqueName(Image.FileName); ReceiptInvoice.ImageName = fileName; var uploaded = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/uploads"); var filePath = Path.Combine(uploaded, fileName); var memory = new MemoryStream(); using (var stream = new FileStream(filePath, FileMode.Create)) { await Image.CopyToAsync(stream); } } Context.ReceiptInvoice.Add(ReceiptInvoice); await Context.SaveChangesAsync(); return(RedirectToPage("./Index")); } // Select DepartmentID if TryUpdateModelAsync fails. PopulateRecieverDropDownList(Context, emptyReceiptInvoice.ClientID); PopulateReciever2DropDownList(Context, emptyReceiptInvoice.VendorID); return(Page()); }
private void btnSTV_Click(object sender, EventArgs e) { BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receipt.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); receipt.Save(); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); invoice.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); invoice.Save(); this.LogActivity("Set-New-STV-No", ReceiptID); XtraMessageBox.Show("STV Number has been saved"); }
public async Task <IActionResult> OnGetAsync(int id) { ReceiptInvoice = await Context.ReceiptInvoice.AsNoTracking().Include(c => c.Client).Include(v => v.Vendor).FirstOrDefaultAsync(m => m.ReceiptInvoiceID == id); if (ReceiptInvoice == null) { return(NotFound()); } var isAuthorized = await AuthorizationService.AuthorizeAsync( User, ReceiptInvoice, EmployeeOperations.Delete); if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } return(Page()); }
private void Button_Click(object sender, RoutedEventArgs e) { try { int result = 0; if (CategoryCombo.SelectedIndex != -1 && ItemCombo.SelectedIndex != -1 && int.TryParse(Quantity.Text, out result) && SalesManCombo.SelectedIndex != -1 && Quantity.Text != "") { int Item_Id = int.Parse(ItemCombo.SelectedValue.ToString()); var SelectItem = context.Items.Where(item => item.ID == Item_Id).FirstOrDefault(); int AvailableQuantity = SelectItem.Quantity; if (int.Parse(Quantity.Text) > AvailableQuantity) { MessageBox.Show("There aren't This Quantity In Store"); return; } if (result < 0) { MessageBox.Show("This Quantity is not Valid Should Be Positive Num Only"); return; } else { int QuantityValue = int.Parse(Quantity.Text); int Sales_id = int.Parse(SalesManCombo.SelectedValue.ToString()); if (CreateObject == false) { recipt = new ReceiptInvoice() { Date = DateTime.Now, salesman = context.salesmans.Where(sales => sales.ID == Sales_id).FirstOrDefault(), ItemInReceiptInvoices = new List <ItemInReceiptInvoice>() }; context.ReceiptInvoices.Add(recipt); CreateObject = true; } ItemInReceiptInvoice itemsRecipted = new ItemInReceiptInvoice(); itemsRecipted.Item = SelectItem; itemsRecipted.ReceiptInvoice = recipt; itemsRecipted.Quantity = QuantityValue; recipt.ItemInReceiptInvoices.Add(itemsRecipted); SelectItem.ItemInReceiptInvoices.Add(itemsRecipted); SelectItem.Quantity -= int.Parse(Quantity.Text); TotalValues += (int.Parse(Quantity.Text) * SelectItem.SellPrice); var saller = context.salesmans.Where(sallr => sallr.ID == Sales_id).First(); saller.ReceiptInvoices.Add(recipt); context.SaveChanges(); Total.Text = TotalValues.ToString(); NoOfInvoice.Text = (context.ReceiptInvoices.Where(recip => recip.ID == recipt.ID).Select(re => re.ID).First()).ToString(); salesMan.Text = SalesManCombo.Text; this.ListView.Items.Add(new ListViewRecipt { ID = int.Parse(NoOfInvoice.Text), Category = CategoryCombo.Text, Item_Name = ItemCombo.Text, Quantity = int.Parse(Quantity.Text), PriceForPiece = SelectItem.SellPrice, TotalPrice = double.Parse(Quantity.Text) * SelectItem.SellPrice }); Edit.IsEnabled = true; Delete.IsEnabled = true; SalesManCombo.IsEnabled = false; Quantity.Text = ""; } } else { MessageBox.Show("Enter Correct Data"); } } catch { MessageBox.Show("Enter Valid Data"); } }
public void AddInvoiceToContext(ReceiptInvoice recipt) { context.ReceiptInvoices.Add(recipt); }
public void AddReciptToSales(salesman sales, ReceiptInvoice itemsRecipted) { sales.ReceiptInvoices.Add(itemsRecipted); }
public void AddItemInReciptToReceipt(ReceiptInvoice recipt, ItemInReceiptInvoice itemReceipt) { recipt.ItemInReceiptInvoices.Add(itemReceipt); }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int?reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") { printout.xrGRVLabel.Text = "GRV No."; } else { printout.xrGRVLabel.Text = "iGRV No."; } if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) { PrepareGRVPrintout(printoutShortage); } printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return(printout); }
public Receipt CreateFakeReceipt(int receiptTypeID, ReceiptInvoice rctInvoice, int userId, int receiptStatusID, int wearehouse =0) { Receipt receipt = new Receipt(); receipt.AddNew(); receipt.DateOfEntry = DateTimeHelper.ServerDateTime; receipt.ReceiptTypeID = receiptTypeID; receipt.ReceiptTypeID = receiptTypeID; receipt.SavedByUserID = userId; receipt.WarehouseID = wearehouse; receipt.ReceiptInvoiceID = rctInvoice.ID; receipt.STVOrInvoiceNo = rctInvoice.STVOrInvoiceNo; receipt.SavedByUserID = userId; if (receipt.IsColumnNull("TransitTransferNo")) { receipt.TransitTransferNo = rctInvoice.TransitTransferNo; } receipt.InsurancePolicyNo = rctInvoice.InsurancePolicyNo; receipt.WayBillNo = rctInvoice.WayBillNo; receipt.ReceiptStatusID = receiptStatusID; receipt.Save(); return receipt; }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) { return; } string warehouseName = string.Empty; try { var dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { return; } ReceiptID = Convert.ToInt32(dr["ReceiptID"]); var receiptDoc = new BLL.Receipt(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receiptDoc.LoadByPrimaryKey(ReceiptID); var GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"]; lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString()); lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString(); txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString(); var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID); txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo; txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo; txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo; txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name; lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName; lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName; lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName; lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString(); lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString(); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString(); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString(); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString(); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString(); var user = new User(); user.LoadByPrimaryKey(receiptDoc.SavedByUserID); lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString(); lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString(); if (!receiveDoc.IsColumnNull("ConfirmedByUserID")) { user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID); lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; } else { lblConfirmedBy.Text = "-"; } var space = string.Empty; var length = warehouseName.Length; HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo; } gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } catch { gridDetails.DataSource = null; } }
private void btnSearch_Click(object sender, EventArgs e) { BLL.ReceiptInvoice rI = new ReceiptInvoice(); rI.GetStatusOfInvoice(txtInvoiceNo.Text); grdInvoiceSearchDetails.DataSource = rI.DefaultView; }
public Receipt CreateFakeReceiptWithInvoicePO(int orderTypeId, int storeId, int?supplierId, string remark, int idPrinted, int receiptTypeID, int userid, int receiptStatusID, int wearehouse = 0) { ReceiptInvoice receiptInvoice = CreateFakeInvoiceWithPO(orderTypeId, storeId, supplierId, remark, idPrinted, userid); return(CreateFakeReceipt(receiptTypeID, receiptInvoice, userid, receiptStatusID, wearehouse)); }
public static void SeedDB(ApplicationDbContext context, string adminID2) { context.Database.EnsureCreated(); if (context.Employee.Any()) { return; // DB has been seeded } var employees = new Employee[] { new Employee { FirstName = "Suha", LastName = "Hasan", Gender = Gender.Female, Nationality = "Pakistan", DoB = DateTime.Parse("1998-04-10"), Grade = 7, Position = "Developer", MaritalStatus = MaritalStatus.Single, Salary = 2000, Allowance1 = 400, Allowance2 = 0, Allowance3 = 0, HiringDate = DateTime.Parse("2019-09-01"), OwnerID = adminID2 } }; foreach (Employee e in employees) { context.Employee.Add(e); } context.SaveChanges(); var clients = new Client[] { new Client { Project = "SABRA.AE", Name = "Islam Al Khalifa", Address = "*****@*****.**", Mobile = "+971503374373", Company = "Sabra Tourism & Travel LLC", Country = "United Arab Emirates" } }; foreach (Client cl in clients) { context.Client.Add(cl); } context.SaveChanges(); var vendors = new Vendor[] { new Vendor { Name = "Planet01", Address = "*****@*****.**", Mobile = "+92-2136942939, +92-3452201069", Company = "Planet 01", Country = "Pakistan", BankName = "Faysal Bank", IBAN = "0119007000006436", BankCountry = "Pakistan" } }; foreach (Vendor ve in vendors) { context.Vendor.Add(ve); } context.SaveChanges(); var invoiceitems = new InvoiceItem[] { new InvoiceItem { Date = "Hosting Unlimited Storage, Unlimited Emails Accounts", Hours = 1, Price = 1000.0 }, new InvoiceItem { Date = "Web Security Shield and SSL Certificate", Hours = 1, Price = 1050.0 }, new InvoiceItem { Date = "Website Transfer and 30 Emails Setup Fees", Hours = 1, Price = 1200.0 }, new InvoiceItem { Date = "Free Domain Name", Hours = 1, Price = 0.0 } }; foreach (InvoiceItem ii in invoiceitems) { context.InvoiceItem.Add(ii); } context.SaveChanges(); /* var jan19payrolls = new Jan19Payroll[] * { * new Jan19Payroll{EmployeeID=employees.Single( e => e.LastName == "Hasan").ID, Deduction=0, OvertimeHours=0, Bonus=0, OwnerID=adminID2} * }; * foreach (Jan19Payroll j in jan19payrolls) * { * context.Jan19Payroll.Add(j); * } * context.SaveChanges(); */ var jan19payrolls = new Jan19Payroll[] { new Jan19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jan19Payroll j in jan19payrolls) { context.Jan19Payroll.Add(j); } context.SaveChanges(); var jan20payrolls = new Jan20Payroll[] { new Jan20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jan20Payroll jj in jan20payrolls) { context.Jan20Payroll.Add(jj); } context.SaveChanges(); var feb19payrolls = new Feb19Payroll[] { new Feb19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Feb19Payroll f in feb19payrolls) { context.Feb19Payroll.Add(f); } context.SaveChanges(); var feb20payrolls = new Feb20Payroll[] { new Feb20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Feb20Payroll ff in feb20payrolls) { context.Feb20Payroll.Add(ff); } context.SaveChanges(); var mar19payrolls = new Mar19Payroll[] { new Mar19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Mar19Payroll m in mar19payrolls) { context.Mar19Payroll.Add(m); } context.SaveChanges(); var mar20payrolls = new Mar20Payroll[] { new Mar20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Mar20Payroll mm in mar20payrolls) { context.Mar20Payroll.Add(mm); } context.SaveChanges(); var apr19payrolls = new Apr19Payroll[] { new Apr19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Apr19Payroll a in apr19payrolls) { context.Apr19Payroll.Add(a); } context.SaveChanges(); var apr20payrolls = new Apr20Payroll[] { new Apr20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Apr20Payroll aa in apr20payrolls) { context.Apr20Payroll.Add(aa); } context.SaveChanges(); var may19payrolls = new May19Payroll[] { new May19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (May19Payroll y in may19payrolls) { context.May19Payroll.Add(y); } context.SaveChanges(); var may20payrolls = new May20Payroll[] { new May20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (May20Payroll yy in may20payrolls) { context.May20Payroll.Add(yy); } context.SaveChanges(); var jun19payrolls = new Jun19Payroll[] { new Jun19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jun19Payroll u in jun19payrolls) { context.Jun19Payroll.Add(u); } context.SaveChanges(); var jun20payrolls = new Jun20Payroll[] { new Jun20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jun20Payroll uu in jun20payrolls) { context.Jun20Payroll.Add(uu); } context.SaveChanges(); var jul19payrolls = new Jul19Payroll[] { new Jul19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jul19Payroll l in jul19payrolls) { context.Jul19Payroll.Add(l); } context.SaveChanges(); var jul20payrolls = new Jul20Payroll[] { new Jul20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Jul20Payroll ll in jul20payrolls) { context.Jul20Payroll.Add(ll); } context.SaveChanges(); var aug19payrolls = new Aug19Payroll[] { new Aug19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Aug19Payroll g in aug19payrolls) { context.Aug19Payroll.Add(g); } context.SaveChanges(); var aug20payrolls = new Aug20Payroll[] { new Aug20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Aug20Payroll gg in aug20payrolls) { context.Aug20Payroll.Add(gg); } context.SaveChanges(); var sep19payrolls = new Sep19Payroll[] { new Sep19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Sep19Payroll p in sep19payrolls) { context.Sep19Payroll.Add(p); } context.SaveChanges(); var sep20payrolls = new Sep20Payroll[] { new Sep20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Sep20Payroll pp in sep20payrolls) { context.Sep20Payroll.Add(pp); } context.SaveChanges(); var oct19payrolls = new Oct19Payroll[] { new Oct19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Oct19Payroll o in oct19payrolls) { context.Oct19Payroll.Add(o); } context.SaveChanges(); var oct20payrolls = new Oct20Payroll[] { new Oct20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Oct20Payroll oo in oct20payrolls) { context.Oct20Payroll.Add(oo); } context.SaveChanges(); var nov19payrolls = new Nov19Payroll[] { new Nov19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Nov19Payroll n in nov19payrolls) { context.Nov19Payroll.Add(n); } context.SaveChanges(); var nov20payrolls = new Nov20Payroll[] { new Nov20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Nov20Payroll nn in nov20payrolls) { context.Nov20Payroll.Add(nn); } context.SaveChanges(); var dec19payrolls = new Dec19Payroll[] { new Dec19Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Dec19Payroll d in dec19payrolls) { context.Dec19Payroll.Add(d); } context.SaveChanges(); var dec20payrolls = new Dec20Payroll[] { new Dec20Payroll { Total = 0, OwnerID = adminID2 } }; foreach (Dec20Payroll dd in dec20payrolls) { context.Dec20Payroll.Add(dd); } context.SaveChanges(); var receiptinvoices = new ReceiptInvoice[] { new ReceiptInvoice { PaymentType = "Expense", Amount = 0 }, new ReceiptInvoice { PaymentType = "Contract", Amount = 0 } }; foreach (ReceiptInvoice rr in receiptinvoices) { context.ReceiptInvoice.Add(rr); } context.SaveChanges(); var paymentinvoices = new PaymentInvoice[] { new PaymentInvoice { Amount = 0 } }; foreach (PaymentInvoice rr in paymentinvoices) { context.PaymentInvoice.Add(rr); } context.SaveChanges(); /* var paymentinvoices = new PaymentInvoice[] * { * new PaymentInvoice{RecieverType= "Client", ClientID = 1, BankAccount="123", Amount=2000, ImageName="completion certificate_6036.pdf", OwnerID=adminID2} * }; * foreach (PaymentInvoice v in paymentinvoices) * { * context.PaymentInvoice.Add(v); * } * context.SaveChanges();*/ }
private void PrintReceiptConfirmation(string referenceNumber, int?reprintOfReceiptConfirmationPrintoutID) { var rc = new ReceiptConfirmationPrintout(); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 3, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new BLL.Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); srmPrintout.xrIssueDateValue.Text = idoc.Date.ToString("M/d/yyyy"); var activity = new Activity(); activity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = activity.FullActivityName; var rct = new BLL.Receipt(); rct.LoadByPrimaryKey(ReceiptID); var rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); srmPrintout.xrSTVNoValue.Text = rctInvoice.STVOrInvoiceNo; } else { var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); srmPrintout.xrAccountName.Text = activity.FullActivityName; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } //Successfully printed //Release Product var GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); var recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); }
public static List<ReceiptInvoice> ToList(BLL.ReceiptInvoice v) { List<ReceiptInvoice> list = new List<ReceiptInvoice>(); while (!v.EOF) { ReceiptInvoice t = new ReceiptInvoice(); if (!v.IsColumnNull("ID")) t.ID = v.ID; if (!v.IsColumnNull("InvoiceTypeID")) t.InvoiceTypeID = v.InvoiceTypeID; if (!v.IsColumnNull("STVOrInvoiceNo")) t.STVOrInvoiceNo = v.STVOrInvoiceNo; if (!v.IsColumnNull("WayBillNo")) t.WayBillNo = v.WayBillNo; if (!v.IsColumnNull("TransitTransferNo")) t.TransitTransferNo = v.TransitTransferNo; if (!v.IsColumnNull("InsurancePolicyNo")) t.InsurancePolicyNo = v.InsurancePolicyNo; if (!v.IsColumnNull("DateOfEntry")) t.DateOfEntry = v.DateOfEntry; if (!v.IsColumnNull("ReceiptInvoiceType")) t.ReceiptInvoiceType = v.ReceiptInvoiceType; if (!v.IsColumnNull("TotalValue")) t.TotalValue = v.TotalValue; if (!v.IsColumnNull("Insurance")) t.Insurance = v.Insurance; if (!v.IsColumnNull("AirFreight")) t.AirFreight = v.AirFreight; if (!v.IsColumnNull("SeaFreight")) t.SeaFreight = v.SeaFreight; if (!v.IsColumnNull("InlandFreight")) t.InlandFreight = v.InlandFreight; if (!v.IsColumnNull("NBE")) t.NBE = v.NBE; if (!v.IsColumnNull("CBE")) t.CBE = v.CBE; if (!v.IsColumnNull("CustomDutyTax")) t.CustomDutyTax = v.CustomDutyTax; if (!v.IsColumnNull("TransitServiceCharge")) t.TransitServiceCharge = v.TransitServiceCharge; if (!v.IsColumnNull("Provision")) t.Provision = v.Provision; if (!v.IsColumnNull("OtherExpense")) t.OtherExpense = v.OtherExpense; if (!v.IsColumnNull("ExchangeRate")) t.ExchangeRate = v.ExchangeRate; if (!v.IsColumnNull("SavedByUserID")) t.SavedByUserID = v.SavedByUserID; if (!v.IsColumnNull("POID")) t.POID = v.POID; if (!v.IsColumnNull("Currency")) t.Currency = v.Currency; if (!v.IsColumnNull("LCID")) t.LCID = v.LCID; list.Add(t); v.MoveNext(); } return list; }