public InvoiceNo GenerateInvoiceNo( ) { InvoiceNo inv = new InvoiceNo(ManualSeries); //TODO: series Start should be changed every Finnical Year; //TODO: Should have option to check data and based on that generate it string iNo = sDB.GetLastInvoiceNo(); if (iNo.Length > 0) { if (iNo != "0") { Logs.LogMe("Inv=" + iNo); iNo = iNo.Substring(5); Logs.LogMe("Inv=" + iNo); long i = long.Parse(iNo); Logs.LogMe("Inv=" + i); inv.TP = i + 1; } else { inv.TP = SeriesStart + 1; } } else { //TODO: check future what happens and what condtion come here inv.TP = SeriesStart + 1; Logs.LogMe("Future check :Inv=" + inv.TP); } return(inv); }
private void Cancel_Click(object sender, RoutedEventArgs e) { CustName.Clear(); InvoiceNo.Clear(); OrderNo.Clear(); InvoiceDate.Clear(); DueDate.Clear(); SubTotal.Clear(); Adjustment.Clear(); Total.Clear(); CustNotes.Clear(); TermAndCondns.Clear(); }
public void Configure(EntityTypeBuilder <Order> orderConfiguration) { orderConfiguration.Property(b => b.Id).HasColumnName("OrderID"); orderConfiguration.Property(b => b.InvoiceNo).HasConversion(p => p.Value, p => InvoiceNo.Create(p).Value).IsRequired().HasMaxLength(10); orderConfiguration.Property(b => b.InvoiceDate).HasConversion(p => p.Value, p => InvoiceDate.Create(p).Value).IsRequired(); orderConfiguration.Property(b => b.ReferenceNo).HasConversion(p => p.Value, p => ReferenceNo.Create(p).Value).IsRequired().HasMaxLength(10); orderConfiguration.HasOne(s => s.Customer).WithMany().IsRequired(); orderConfiguration.HasMany(s => s.OrderLines).WithOne(e => e.Order); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (string.IsNullOrEmpty(InvoiceNo)) { yield return(new ValidationResult("InvoiceNo harus diisi", new List <string> { "InvoiceNo" })); } if (string.IsNullOrEmpty(From)) { yield return(new ValidationResult("From harus diisi", new List <string> { "From" })); } if (string.IsNullOrEmpty(To)) { yield return(new ValidationResult("To harus diisi", new List <string> { "To" })); } if (SailingDate == default(DateTimeOffset)) { yield return(new ValidationResult("SailingDate harus diisi", new List <string> { "SailingDate" })); } if (string.IsNullOrEmpty(Consignee)) { yield return(new ValidationResult("Consignee harus diisi", new List <string> { "Consignee" })); } if (string.IsNullOrEmpty(ShippingPer)) { yield return(new ValidationResult("ShippingPer harus diisi", new List <string> { "ShippingPer" })); } //if (string.IsNullOrEmpty(ConfirmationOfOrderNo)) // yield return new ValidationResult("ConfirmationOfOrderNo harus diisi", new List<string> { "ConfirmationOfOrderNo" }); if (string.IsNullOrEmpty(ShippingStaff)) { yield return(new ValidationResult("ShippingStaff harus diisi", new List <string> { "ShippingStaff" })); } if (string.IsNullOrEmpty(FabricType)) { yield return(new ValidationResult("FabricType harus diisi", new List <string> { "FabricType" })); } //if (string.IsNullOrEmpty(BankAccount)) // yield return new ValidationResult("BankDetail harus diisi", new List<string> { "BankAccount" }); if (!string.IsNullOrEmpty(InvoiceNo) && !InvoiceNo.Contains("SM/")) { if (PaymentDue.Equals(0)) { yield return(new ValidationResult("PaymentDue harus diisi", new List <string> { "PaymentDue" })); } } if (string.IsNullOrEmpty(CPrice)) { yield return(new ValidationResult("CPrice harus diisi", new List <string> { "CPrice" })); } if (string.IsNullOrEmpty(ConsigneeAddress)) { yield return(new ValidationResult("ConsigneeAddress harus diisi", new List <string> { "ConsigneeAddress" })); } if (Items.Count == 0) { yield return(new ValidationResult("Detail harus Diisi", new List <string> { "ItemsCount" })); } else { int errorItemsCount = 0; List <Dictionary <string, object> > errorItems = new List <Dictionary <string, object> >(); foreach (var item in Items) { Dictionary <string, object> errorItem = new Dictionary <string, object>(); if (string.IsNullOrWhiteSpace(item.RONo)) { errorItem["RONo"] = "RONo tidak boleh kosong"; errorItemsCount++; } if (item.Quantity == 0) { errorItem["Quantity"] = "Quantity tidak boleh 0"; errorItemsCount++; } if (item.Price == 0) { errorItem["Price"] = "Price tidak boleh 0"; errorItemsCount++; } errorItems.Add(errorItem); } if (errorItemsCount > 0) { yield return(new ValidationResult(JsonConvert.SerializeObject(errorItems), new List <string> { "Items" })); } } if (GarmentShippingInvoiceAdjustments.Count > 0) { int errorAdjustmentCount = 0; List <Dictionary <string, object> > errorAdjustments = new List <Dictionary <string, object> >(); foreach (var item in GarmentShippingInvoiceAdjustments) { Dictionary <string, object> errorItem = new Dictionary <string, object>(); if (string.IsNullOrEmpty(item.AdjustmentDescription) && item.AdjustmentValue > 0) { errorItem["AdjustmentDescription"] = "AdjustmentDescription tidak boleh kosong"; errorAdjustmentCount++; } if (item.AdjustmentValue == 0 && item.AdjustmentDescription != "") { errorItem["AdjustmentValue"] = "AdjustmentValue tidak boleh 0"; errorAdjustmentCount++; } errorAdjustments.Add(errorItem); } if (errorAdjustmentCount > 0) { yield return(new ValidationResult(JsonConvert.SerializeObject(errorAdjustments), new List <string> { "GarmentShippingInvoiceAdjustments" })); } } }