Example #1
0
            private void UpsertInvoice(Guid id, InvoiceNumber invoiceNumber)
            {
                using (var transactionScope = new TransactionScope(TransactionScopeOption.Suppress))
                {
                    using (var connection = new SqlConnection(Program.ConnectionString))
                    {
                        connection.Open();
                        var sql = @"
IF NOT EXISTS (SELECT * FROM dbo.Invoice WHERE Id = @id)
    INSERT INTO dbo.Invoice (Id, InvoiceNumber)
    VALUES (@id, @invoiceNumber)
ELSE
    UPDATE dbo.Invoice SET InvoiceNumber = @invoiceNumber
    WHERE Id = @Id
";

                        using (var command = new SqlCommand(sql, connection))
                        {
                            command.Parameters.AddWithValue("@invoiceNumber", invoiceNumber.Number);
                            command.Parameters.AddWithValue("@id", id);

                            command.ExecuteNonQuery();
                        }
                    }
                    transactionScope.Complete();
                }
            }
        /// <summary>
        /// Returns true if OrderInvoiceData instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderInvoiceData to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderInvoiceData other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AdditionalData == other.AdditionalData ||
                     AdditionalData != null &&
                     AdditionalData.Equals(other.AdditionalData)
                     ) &&
                 (
                     InvoiceDate == other.InvoiceDate ||
                     InvoiceDate != null &&
                     InvoiceDate.Equals(other.InvoiceDate)
                 ) &&
                 (
                     InvoiceNumber == other.InvoiceNumber ||
                     InvoiceNumber != null &&
                     InvoiceNumber.Equals(other.InvoiceNumber)
                 ) &&
                 (
                     TextQualifiers == other.TextQualifiers ||
                     TextQualifiers != null &&
                     TextQualifiers.SequenceEqual(other.TextQualifiers)
                 ));
        }
 /// <summary>
 /// Implements the execution of <see cref="GetInvoiceInfoCommand" />
 /// </summary>
 private void GetInvoiceInfoCommand_Execute(object obj)
 {
     if (int.TryParse(InvoiceNumber.ToString(), out int d))
     {
         GetInvoices(StartDatePurchase, EndDatePurchase, d);
     }
 }
Example #4
0
        public void Will_Throw_When_Last_Invoice_Number_Is_Newer_Than_Issue_Date()
        {
            var issueDate = new DateTime(2020, 10, 1);
            var oldNumber = new InvoiceNumber(3, 2020, 10, 2, "");

            Should.Throw <InvalidOperationException>(() => _generator.GetNext(issueDate, oldNumber));
        }
Example #5
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Invoice other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((PrimaryRecipient == null && other.PrimaryRecipient == null) || (PrimaryRecipient?.Equals(other.PrimaryRecipient) == true)) &&
                   ((PaymentRequests == null && other.PaymentRequests == null) || (PaymentRequests?.Equals(other.PaymentRequests) == true)) &&
                   ((DeliveryMethod == null && other.DeliveryMethod == null) || (DeliveryMethod?.Equals(other.DeliveryMethod) == true)) &&
                   ((InvoiceNumber == null && other.InvoiceNumber == null) || (InvoiceNumber?.Equals(other.InvoiceNumber) == true)) &&
                   ((Title == null && other.Title == null) || (Title?.Equals(other.Title) == true)) &&
                   ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) &&
                   ((ScheduledAt == null && other.ScheduledAt == null) || (ScheduledAt?.Equals(other.ScheduledAt) == true)) &&
                   ((PublicUrl == null && other.PublicUrl == null) || (PublicUrl?.Equals(other.PublicUrl) == true)) &&
                   ((NextPaymentAmountMoney == null && other.NextPaymentAmountMoney == null) || (NextPaymentAmountMoney?.Equals(other.NextPaymentAmountMoney) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((CustomFields == null && other.CustomFields == null) || (CustomFields?.Equals(other.CustomFields) == true)));
        }
Example #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (VIN != null ? VIN.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleMake != null ? VehicleMake.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleModel != null ? VehicleModel.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TyreSize != null ? TyreSize.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VehicleType != null ? VehicleType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (WFactor != null ? WFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (KFactor != null ? KFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LFactor != null ? LFactor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OdometerReading != null ? OdometerReading.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Tampered.GetHashCode();
         hashCode = (hashCode * 397) ^ (InvoiceNumber != null ? InvoiceNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (InspectionInfo != null ? InspectionInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TachographHasAdapter.GetHashCode();
         hashCode = (hashCode * 397) ^ (TachographAdapterSerialNumber != null ? TachographAdapterSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographAdapterLocation != null ? TachographAdapterLocation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographCableColor != null ? TachographCableColor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MinorWorkDetails != null ? MinorWorkDetails.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TachographType != null ? TachographType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CardSerialNumber != null ? CardSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CalibrationTime.GetHashCode();
         hashCode = (hashCode * 397) ^ IsDigital.GetHashCode();
         hashCode = (hashCode * 397) ^ NewBattery.GetHashCode();
         hashCode = (hashCode * 397) ^ (NewInspectionInfo != null ? NewInspectionInfo.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public InvoiceNumber GetNext(DateTime issueDate, InvoiceNumber lastInvoiceNumber)
        {
            if (lastInvoiceNumber != null)
            {
                if (lastInvoiceNumber.OrderingNumber >= MaxOrderingNumber)
                {
                    throw new InvalidOperationException(
                              $"Cannot generate new unique number greater than {MaxOrderingNumber}");
                }

                if (issueDate < lastInvoiceNumber.IssuedAt)
                {
                    throw new InvalidOperationException("Cannot generate new number for older date.");
                }
            }

            var newOrderingNumber = lastInvoiceNumber == null || !SameMonth(issueDate, lastInvoiceNumber)
                ? 1
                : lastInvoiceNumber.OrderingNumber + 1;

            return(new InvoiceNumber(newOrderingNumber,
                                     issueDate.Year,
                                     issueDate.Month,
                                     issueDate.Day,
                                     $"{PadInt(newOrderingNumber, MaxOrderingNumberLen)}/{PadInt(issueDate.Month, 2)}/{issueDate.Year}"));
        }
Example #8
0
        private void SearchInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                int invoiceid = Convert.ToInt32(InvoiceNumber.Text);

                SqlConnection con = new SqlConnection(Helper.con);
                con.Open();
                string         query = "select * from DeletedBill where InvioceID  = '" + invoiceid + "' ";
                SqlCommand     cmd   = new SqlCommand(query, con);
                DataTable      dt    = new DataTable();
                SqlDataAdapter da    = new SqlDataAdapter(cmd);
                da.Fill(dt);
                dgv1.DataSource = dt;
                con.Close();

                dgv1.Columns[0].HeaderText  = "INVOICE ID";
                dgv1.Columns[1].HeaderText  = "CUST ID";
                dgv1.Columns[2].HeaderText  = "ORDER ID";
                dgv1.Columns[3].HeaderText  = "CUST NAME";
                dgv1.Columns[4].HeaderText  = "PRODUCT NAME";
                dgv1.Columns[5].HeaderText  = "PRODUCT QTY";
                dgv1.Columns[6].HeaderText  = "PRODUCT RATE";
                dgv1.Columns[7].HeaderText  = "PRODUCT AMOUNT";
                dgv1.Columns[8].HeaderText  = "GST AMOUNT";
                dgv1.Columns[9].HeaderText  = "ORDER TIME";
                dgv1.Columns[10].HeaderText = "ORDER DATE";
                dgv1.Columns[11].HeaderText = "TOTAL QTY";
                dgv1.Columns[11].Visible    = false;
                dgv1.Columns[12].HeaderText = "ACTUAL AMOUNT";
                dgv1.Columns[12].Visible    = false;
                dgv1.Columns[13].HeaderText = "TOTAL AMOUNT";
                dgv1.Columns[13].Visible    = false;
                dgv1.Columns[14].HeaderText = "TOTAL GST AMOUNT";
                dgv1.Columns[14].Visible    = false;
                dgv1.Columns[15].HeaderText = "DISCOUNT";
                dgv1.Columns[15].Visible    = false;

                totalquantity.Text = "0";
                totalprice.Text    = "0";

                int    totalQuantity = 0;
                double totalAmount   = 0;

                for (int i = 0; i < dgv1.Rows.Count; ++i)
                {
                    totalQuantity += Convert.ToInt32(dgv1.Rows[i].Cells[5].Value);
                    totalAmount   += Convert.ToDouble(dgv1.Rows[i].Cells[7].Value);
                }

                totalquantity.Text = totalQuantity.ToString();
                totalprice.Text    = totalAmount.ToString();
                InvoiceNumber.Text = "";
                InvoiceNumber.Focus();
            }
            catch (Exception)
            {
                MessageBox.Show("InvoiceID cannot be blank");
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AdditionalData != null)
         {
             hashCode = hashCode * 59 + AdditionalData.GetHashCode();
         }
         if (InvoiceDate != null)
         {
             hashCode = hashCode * 59 + InvoiceDate.GetHashCode();
         }
         if (InvoiceNumber != null)
         {
             hashCode = hashCode * 59 + InvoiceNumber.GetHashCode();
         }
         if (TextQualifiers != null)
         {
             hashCode = hashCode * 59 + TextQualifiers.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #10
0
        /// <summary>
        /// Outputs string containing the following (replace [] with actual values):
        /// Invoice Number: [InvoiceNumber], InvoiceDate: [dd/MM/yyyy], LineItemCount: [Number of items in LineItems]
        /// </summary>
        public override string ToString()
        {
            string invoiceNumber = InvoiceNumber.ToString();
            string invoiceDate   = InvoiceDate.ToString("dd/MM/yyyy");
            string lineItems     = LineItems.Count().ToString();

            return($"Invoice Number: {invoiceNumber}, InvoiceDate: {invoiceDate}, LineItemCount: {lineItems}");
        }
        /// <summary>
        /// Returns true if Seller instances are equal
        /// </summary>
        /// <param name="other">Instance of Seller to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Seller other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                     ) &&
                 (
                     ChannelCode == other.ChannelCode ||
                     ChannelCode != null &&
                     ChannelCode.Equals(other.ChannelCode)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Geocode == other.Geocode ||
                     Geocode != null &&
                     Geocode.Equals(other.Geocode)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     InvoiceNumber == other.InvoiceNumber ||
                     InvoiceNumber != null &&
                     InvoiceNumber.Equals(other.InvoiceNumber)
                 ) &&
                 (
                     Mcc == other.Mcc ||
                     Mcc != null &&
                     Mcc.Equals(other.Mcc)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ));
        }
        public void Will_Return_True_For_Same_FormattedNumber()
        {
            var formattedNumber = Guid.NewGuid().ToString();
            var number1         = new InvoiceNumber(1, 2, 3, 4, formattedNumber);
            var number2         = new InvoiceNumber(2, 3, 4, 5, formattedNumber);

            number1.Equals(number2).ShouldBeTrue();
            (number1 == number2).ShouldBeTrue();
        }
Example #13
0
 public override int GetHashCode()
 {
     return(InvoiceNumber.GetHashCode()
            ^ InvoiceType.GetHashCode()
            ^ InvoiceStatus.GetHashCode()
            ^ Lines.GetHashCode()
            ^ Total.GetHashCode()
            ^ Carrier.GetHashCode());
 }
        public ActionResult Reissueinvoice(ReissueinvoiceModel reiinv)
        {
            int accId = User.GetAccountId();
            var reissueinvoiceModel = new ReissueinvoiceModel()
            {
                ListNo = ListNos()
            };

            DateTime dateTime = DateTime.Parse(reiinv.StartUsingDate.ToString(), System.Globalization.CultureInfo.
                                               GetCultureInfo("vi-VN").
                                               DateTimeFormat);

            //if (dateTime < DateTime.Now)
            //{
            //    ModelState.AddModelError(String.Empty, ReissueinvoiceResource.StartUsingDateEqua.ToString());
            //    return View(reissueinvoiceModel);
            //}
            if (ModelState.IsValid)
            {
                using (var scope = new TransactionScope())
                {
                    var listReleaseInvoice = new ListReleaseInvoice()
                    {
                        Quantity       = reiinv.Quantity,
                        StartNumber    = reiinv.StartNumber,
                        EndNumber      = reiinv.EndNumber,
                        StartUsingDate = dateTime,
                        AccountId      = accId,
                        TemplateCode   = reiinv.TemplateId,
                        Status         = 0,
                        SerialInvoice  = reiinv.SerialInvoice,
                        No             = reiinv.No
                    };
                    _listReleaseInvoice.CreateListReleaseInvoices(listReleaseInvoice);

                    for (int i = reiinv.StartNumber; i <= reiinv.EndNumber; i++)
                    {
                        var invoiceNumber = new InvoiceNumber()
                        {
                            InvoicesNumber = i,
                            UseStatus      = 0,
                            ReleaseId      = listReleaseInvoice.Id,
                            Status         = 0,
                            AccountId      = accId
                        };
                        _invoiceNumber.CreateInvoiceNumbers(invoiceNumber);
                    }
                    scope.Complete();
                }
                return(RedirectToAction("Index", new { message = "Phát hành hóa đơn thành công. Xem lại trên giao diện", messageType = "info" }));
            }
            else
            {
                return(View(reissueinvoiceModel));
            }
        }
 public int GetIdempotentKey()
 {
     unchecked
     {
         int hashCode = InvoiceNumber?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (OrderDetails?.GetIdempotentKey() ?? 0);
         hashCode = (hashCode * 397) ^ (OrderNumber?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Example #16
0
        private ModificationInvoice CreateModificationInvoice(InvoiceNumber originalDocumentNumber, Receiver receiver)
        {
            var nowUtc      = DateTime.UtcNow.Date;
            var item1Amount = new Amount(net: new AmountValue(-1694.92m), gross: new AmountValue(-2000), tax: new AmountValue(-305.08m));
            var item2Amount = new Amount(new AmountValue(-2362.20m), new AmountValue(-3000), new AmountValue(-637.8m));
            var item3Amount = new Amount(new AmountValue(-952.38m), new AmountValue(-1000), new AmountValue(-47.62m));
            var unitAmount1 = new ItemAmounts(item1Amount, item1Amount, 0.18m);
            var unitAmount2 = new ItemAmounts(item2Amount, item2Amount, 0.27m);
            var unitAmount3 = new ItemAmounts(item3Amount, item3Amount, 0.05m);
            var items       = new[]
            {
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.18m),
                    description: Description.Create("Item 1 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: -1,
                    unitAmounts: unitAmount1,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.27m),
                    description: Description.Create("Item 2 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: -1,
                    unitAmounts: unitAmount2,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item3Amount, item3Amount, 0.05m),
                    description: Description.Create("Item 3 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: -1,
                    unitAmounts: unitAmount3,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    )
            };

            return(new ModificationInvoice(
                       number: InvoiceNumber.Create($"REBATE-{Guid.NewGuid()}").Success.Get(),
                       supplierInfo: CreateSupplierInfo(),
                       receiver: receiver,
                       items: Sequence.FromPreordered(items, startIndex: 1).Get(),
                       currencyCode: CurrencyCode.Create("EUR").Success.Get(),
                       issueDate: nowUtc,
                       paymentDate: nowUtc,
                       itemIndexOffset: 3,
                       modificationIndex: 1,
                       modifyWithoutMaster: false,
                       originalDocumentNumber: originalDocumentNumber,
                       paymentMethod: PaymentMethod.Cash
                       ));
        }
Example #17
0
        public async Task SendCorrectionCustomerInvoiceSucceeds()
        {
            var receiver           = Receiver.Customer();
            var invoiceNumber      = InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get();
            var sendInvoicesResult = await SendInvoices(receiver, invoiceNumber);

            await AssertInvoices(sendInvoicesResult);

            var sendModificationInvoicesResult = await SendModificationInvoices(receiver, originalInvoiceNumber : invoiceNumber);

            await AssertInvoices(sendModificationInvoicesResult);
        }
Example #18
0
        public static string GetClaAccessInvoiceNumber(DefaultContext db)
        {
            string newInvoiceNumberValue;
            lock (LockClaAccessInvoiceNumber)
            {
                string invoiceNumberValue = GetPropertiesBagItem(db, ClaAccessInvoiceNumberKey);
                var invoiceNumber = new InvoiceNumber(invoiceNumberValue);
                newInvoiceNumberValue = invoiceNumber.Next();
                SavePropertiesBagItem(db, ClaAccessInvoiceNumberKey, newInvoiceNumberValue, false);
            }

            return newInvoiceNumberValue;
        }
Example #19
0
        private Invoice CreateInvoice(Receiver receiver, InvoiceNumber invoiceNumber = null)
        {
            var nowUtc      = DateTime.UtcNow.Date;
            var item1Amount = new Amount(net: new AmountValue(1694.92m), gross: new AmountValue(2000), tax: new AmountValue(305.08m));
            var item2Amount = new Amount(new AmountValue(2362.20m), new AmountValue(3000), new AmountValue(637.8m));
            var item3Amount = new Amount(new AmountValue(952.38m), new AmountValue(1000), new AmountValue(47.62m));
            var unitAmount1 = new ItemAmounts(item1Amount, item1Amount, 0.18m);
            var unitAmount2 = new ItemAmounts(item2Amount, item2Amount, 0.27m);
            var unitAmount3 = new ItemAmounts(item3Amount, item3Amount, 0.05m);
            var items       = new[]
            {
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.18m),
                    description: Description.Create("Item 1 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: 1,
                    unitAmounts: unitAmount1,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.27m),
                    description: Description.Create("Item 2 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: 1,
                    unitAmounts: unitAmount2,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
                new InvoiceItem(
                    consumptionDate: nowUtc,
                    totalAmounts: new ItemAmounts(item3Amount, item3Amount, 0.05m),
                    description: Description.Create("Item 3 description").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: 1,
                    unitAmounts: unitAmount3,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    )
            };

            return(new Invoice(
                       number: invoiceNumber ?? InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get(),
                       issueDate: nowUtc,
                       supplierInfo: CreateSupplierInfo(),
                       receiver: receiver,
                       items: Sequence.FromPreordered(items, startIndex: 1).Get(),
                       paymentDate: nowUtc,
                       currencyCode: CurrencyCode.Create("EUR").Success.Get(),
                       paymentMethod: PaymentMethod.Card
                       ));
        }
Example #20
0
        public string ValidateInvoiceNumber(string invoiceNumber)
        {
            string message = string.Empty;

            try
            {
                InvoiceNumber.Validate(invoiceNumber);
            }
            catch (ArgumentException e)
            {
                message = e.Message;
            }
            return(message);
        }
Example #21
0
        internal override bool isValid()
        {
            if (DateIssuedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateIssuedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateApprovedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateApprovedTo != DateTime.MinValue)
            {
                return(true);
            }

            int requiredFilterCount = OrderID.NullSafeLength() +
                                      Username.NullSafeLength() +
                                      RmaID.NullSafeLength() +
                                      InvoiceNumber.NullSafeLength() +
                                      RmaStatus.NullSafeLength() +
                                      SplitKitComponents.NullSafeLength();



            if (requiredFilterCount != 0)
            {
                return(true);
            }

            throw new NetoRequestException("At least one filter is required in the GetRMA request");
        }
Example #22
0
        public async Task SendCorrectionLocalCompanyInvoiceSucceeds()
        {
            var receiver = Receiver.LocalCompany(
                taxpayerId: TaxpayerIdentificationNumber.Create(Countries.Hungary, "10630433").Success.Get(),
                name: Name.Create("Hungarian test company ltd.").Success.Get(),
                address: CreateAddress(Countries.Hungary)
                ).Success.Get();
            var invoiceNumber      = InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get();
            var sendInvoicesResult = await SendInvoices(receiver, invoiceNumber);

            await AssertInvoices(sendInvoicesResult);

            var sendModificationInvoiceResponse = await SendModificationInvoices(receiver, originalInvoiceNumber : invoiceNumber);

            await AssertInvoices(sendModificationInvoiceResponse);
        }
Example #23
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            dgv1.Refresh();
            LoadGridView();

            totalQuantity = 0;
            actualAmount  = 0;
            invoiceid2    = 0;

            ActualAmount.Text   = "0";
            TotalQty.Text       = "0";
            TotalAmount.Text    = "0";
            txtDiscount.Text    = string.Empty;
            txtDiscount.Visible = false;
            InvoiceNumber.Text  = string.Empty;
            InvoiceNumber.Focus();
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Address != null)
         {
             hashCode = hashCode * 59 + Address.GetHashCode();
         }
         if (ChannelCode != null)
         {
             hashCode = hashCode * 59 + ChannelCode.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Geocode != null)
         {
             hashCode = hashCode * 59 + Geocode.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (InvoiceNumber != null)
         {
             hashCode = hashCode * 59 + InvoiceNumber.GetHashCode();
         }
         if (Mcc != null)
         {
             hashCode = hashCode * 59 + Mcc.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #25
0
        public async Task SendCorrectionForeignCompanyInvoiceSucceeds(string countryCode, string taxId)
        {
            var country        = Countries.GetByCode(countryCode).Get();
            var taxpayerNumber = taxId.ToNonEmptyOption().Map(i => TaxpayerIdentificationNumber.Create(country, i).Success.Get());
            var receiver       = Receiver.ForeignCompany(
                name: Name.Create("Foreign test company ltd.").Success.Get(),
                address: CreateAddress(country),
                taxpayerId: taxpayerNumber.GetOrNull()
                ).Success.Get();
            var invoiceNumber      = InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get();
            var sendInvoicesResult = await SendInvoices(receiver, invoiceNumber);

            await AssertInvoices(sendInvoicesResult);

            var sendModificationInvoiceResponse = await SendModificationInvoices(receiver, originalInvoiceNumber : invoiceNumber);

            await AssertInvoices(sendModificationInvoiceResponse);
        }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (InvoiceNumber?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Description?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DateIssued?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Amount?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CustomerType?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CumulativeBalance?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalPrice?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DescriptionTwo?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Attribute?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (InvoiceAttachment?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Status?.GetHashCode() ?? 0);
            return(hashCode);
        }
Example #27
0
 public void InsertNumber(string invoiceNo = null, string orderNo = null, string quoteNo = null, string refrenceNo = null)
 {
     if (!string.IsNullOrEmpty(invoiceNo))
     {
         InvoiceNumber.SendKeys(invoiceNo);
     }
     if (!string.IsNullOrEmpty(orderNo))
     {
         OrderNumber.SendKeys(orderNo);
     }
     if (!string.IsNullOrEmpty(quoteNo))
     {
         QuotaNo.SendKeys(quoteNo);
     }
     if (!string.IsNullOrEmpty(refrenceNo))
     {
         RefrenceNo.SendKeys(refrenceNo);
     }
 }
        private ModificationInvoice GetModificationInvoice()
        {
            var amounts     = GetItemAmounts(amount: 100, exchangeRate: 300);
            var unitAmounts = GetItemAmounts(amount: 100, exchangeRate: 300);
            var item        = new InvoiceItem(
                consumptionDate: new DateTime(2020, 08, 30),
                totalAmounts: amounts,
                description: Description.Create("NIGHT 8/30/2020").Success.Get(),
                measurementUnit: MeasurementUnit.Night,
                quantity: -1,
                unitAmounts: unitAmounts,
                exchangeRate: ExchangeRate.Create(300).Success.Get()
                );

            var amounts1     = GetItemAmounts(amount: 100, exchangeRate: 300);
            var unitAmounts1 = GetItemAmounts(amount: 100, exchangeRate: 300);
            var item1        = new InvoiceItem(
                consumptionDate: new DateTime(2020, 08, 31),
                totalAmounts: amounts1,
                description: Description.Create("NIGHT2 8/31/2020").Success.Get(),
                measurementUnit: MeasurementUnit.Night,
                quantity: 1,
                unitAmounts: unitAmounts1,
                exchangeRate: ExchangeRate.Create(300).Success.Get()
                );

            return(new ModificationInvoice(
                       number: InvoiceNumber.Create("ABC-18abfcefsaa").Success.Get(),
                       supplierInfo: GetSupplierInfo(),
                       customerInfo: GetCustomerInfo(),
                       items: Sequence.FromPreordered(new[] { item, item1 }, startIndex: 1).Get(),
                       currencyCode: CurrencyCode.Create("USD").Success.Get(),
                       issueDate: new DateTime(2020, 08, 31),
                       paymentDate: new DateTime(2020, 08, 31),
                       itemIndexOffset: 4,
                       modificationIndex: 4,
                       modifyWithoutMaster: true,
                       originalDocumentNumber: InvoiceNumber.Create("ABC-18afasadafa").Success.Get()
                       ));
        }
        private Invoice GetInvoice()
        {
            var item1Amount = new Amount(new AmountValue(1), new AmountValue(1), new AmountValue(0));
            var item2Amount = new Amount(new AmountValue(20m), new AmountValue(16.81m), new AmountValue(3.19m));
            var unitAmount1 = new ItemAmounts(item1Amount, item2Amount, 0.05m);
            var items       = new[]
            {
                new InvoiceItem(
                    consumptionDate: new DateTime(2020, 06, 30),
                    totalAmounts: new ItemAmounts(item1Amount, item1Amount, 0.05m),
                    description: Description.Create("Httt hzi serts (fl)").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: 15,
                    unitAmounts: unitAmount1,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
                new InvoiceItem(
                    consumptionDate: new DateTime(2020, 06, 30),
                    totalAmounts: new ItemAmounts(item2Amount, item2Amount, 0.05m),
                    description: Description.Create("Httt hzi serts (fl)").Success.Get(),
                    measurementUnit: MeasurementUnit.Night,
                    quantity: -15,
                    unitAmounts: unitAmount1,
                    exchangeRate: ExchangeRate.Create(1).Success.Get()
                    ),
            };

            var address = GetAddress();

            return(new Invoice(
                       number: InvoiceNumber.Create("ABC-18a").Success.Get(),
                       issueDate: new DateTime(2020, 06, 30),
                       supplierInfo: GetSupplierInfo(),
                       customerInfo: GetCustomerInfo(),
                       items: Sequence.FromPreordered(items, startIndex: 1).Get(),
                       paymentDate: new DateTime(2020, 06, 14),
                       currencyCode: CurrencyCode.Create("EUR").Success.Get()
                       ));
        }
Example #30
0
        private void SearchInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                int invoiceid = Convert.ToInt32(InvoiceNumber.Text);

                SqlConnection con = new SqlConnection(Helper.con);
                con.Open();
                string         query = "select * from Bill where InvioceID  = '" + invoiceid + "' ";
                SqlCommand     cmd   = new SqlCommand(query, con);
                DataTable      dt    = new DataTable();
                SqlDataAdapter da    = new SqlDataAdapter(cmd);
                da.Fill(dt);
                dgv1.DataSource = dt;
                con.Close();

                totalquantity.Text = "0";
                totalprice.Text    = "0";

                int    totalQuantity = 0;
                double totalAmount   = 0;

                for (int i = 0; i < dgv1.Rows.Count; ++i)
                {
                    totalQuantity += Convert.ToInt32(dgv1.Rows[i].Cells[5].Value);
                    totalAmount   += Convert.ToDouble(dgv1.Rows[i].Cells[7].Value);
                }

                totalquantity.Text = totalQuantity.ToString();
                totalprice.Text    = totalAmount.ToString();
                InvoiceNumber.Text = "";
                InvoiceNumber.Focus();
            }
            catch (Exception)
            {
                MessageBox.Show("InvoiceID cannot be blank");
            }
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (groupBookingId_ != null)
            {
                hash ^= GroupBookingId.GetHashCode();
            }
            if (InvoiceNumber != 0)
            {
                hash ^= InvoiceNumber.GetHashCode();
            }
            if (invoiceId_ != null)
            {
                hash ^= InvoiceId.GetHashCode();
            }
            if (Voided != false)
            {
                hash ^= Voided.GetHashCode();
            }
            if (createdBy_ != null)
            {
                hash ^= CreatedBy.GetHashCode();
            }
            if (voidedBy_ != null)
            {
                hash ^= VoidedBy.GetHashCode();
            }
            if (voidedAt_ != null)
            {
                hash ^= VoidedAt.GetHashCode();
            }
            if (createdAt_ != null)
            {
                hash ^= CreatedAt.GetHashCode();
            }
            return(hash);
        }