public async Task <AssignmentInvoiceDto> ExecuteQueryAsync(GetAssignmentInvoiceQuery query, CancellationToken cancellationToken)
        {
            var invoiceId = InvoiceId.With(query.InvoiceId).Value;
            var readModel = await _readStore.GetAsync(invoiceId, cancellationToken).ConfigureAwait(false);

            return(readModel.ReadModel.ToAssignmentInvoiceDto());
        }
Exemple #2
0
        public async Task SendReminder(Guid invoiceId)
        {
            var invoice = await _queryProcessor.ProcessAsync(new GetInvoiceQuery(invoiceId), CancellationToken.None);

            var invoiceEmployee = await _queryProcessor.ProcessAsync(new GetInvoiceEmployeeQuery(invoice.EmployeeId), CancellationToken.None);

            var invoiceCustomer = await _queryProcessor.ProcessAsync(new GetInvoiceCustomerQuery(invoice.CustomerId), CancellationToken.None);

            _invoicePrinter.PrintReminder(invoiceEmployee.Name, invoiceCustomer.Address);
            await _commandBus.PublishAsync(new InvoiceReminderCommand(InvoiceId.With(invoiceId)), CancellationToken.None);
        }
 private IDFacturaExpedidaType Convert(InvoiceId id)
 {
     return(new IDFacturaExpedidaType
     {
         FechaExpedicionFacturaEmisor = Convert(id.Date),
         IDEmisorFactura = new IDFacturaExpedidaTypeIDEmisorFactura
         {
             NIF = id.Issuer.TaxpayerNumber
         },
         NumSerieFacturaEmisor = id.Number.Value
     });
 }
        internal void Populate_InspHireInvoice(Dictionary <string, string> invoice)
        {
            DateTime tmpDateTime;
            Decimal  tmpDecimal;
            double   tmpDouble;

            InvoiceAccount = invoice["ACCT"];
            AccountName    = invoice["ACCTNAME"];

            InvoiceId = invoice["INVNO"];
            if (!string.IsNullOrEmpty(InvoiceId) && InvoiceId.IndexOf(".") != -1)
            {
                InvoiceId = InvoiceId.Substring(0, InvoiceId.IndexOf("."));
            }

            if (DateTime.TryParse(invoice["DATE"], out tmpDateTime))
            {
                InvoiceDate = tmpDateTime;
            }

            // invoice["SETTDAYS"] ??
            if (Double.TryParse(invoice["SETTDAYS"], out tmpDouble))
            {
                DueDate = InvoiceDate.AddDays(tmpDouble);
            }

            if (DueDate < DateTime.Now)
            {
                DaysOverdue = (DateTime.Now - DueDate).Days;
            }

            //SalesBalanceMST ?? I dont think this is used sitewide

            if (Decimal.TryParse(invoice["VAT"], out tmpDecimal))
            {
                SumTaxMST = tmpDecimal;
            }
            if (Decimal.TryParse(invoice["GOODS"], out tmpDecimal))
            {
                InvoiceAmountMST = tmpDecimal;
            }

            if (Decimal.TryParse(invoice["AMTPAID"], out tmpDecimal))
            {
                AMTPAID = (int)tmpDecimal;
            }
            IsPaid = AMTPAID == InvoiceAmountMST;

            SalesType = invoice["INVTYPE"];

            ContactPersonId = SPCODE = invoice["SPCODE"];
            SalesId         = CONTNO = invoice["CONTNO"];
        }
Exemple #5
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DeliveryDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrderQuantity?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrderDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (InvoiceId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (InvoiceDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FundedRate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (InterestRate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalValue?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FundingValue?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PaymentId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PayementDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CreditNoteNumber?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemple #6
0
        public async Task SendInvoice(SendInvoiceRequest request)
        {
            // Get data stored in this service
            var invoice = await _queryProcessor.ProcessAsync(new GetInvoiceQuery(request.InvoiceId), CancellationToken.None);

            var invoiceEmployee = await _queryProcessor.ProcessAsync(new GetInvoiceEmployeeQuery(invoice.EmployeeId), CancellationToken.None);

            var invoiceCustomer = await _queryProcessor.ProcessAsync(new GetInvoiceCustomerQuery(invoice.CustomerId), CancellationToken.None);

            var amount = invoice.InvoiceItems.Sum(item => item.Price * invoice.Vat);

            if (invoice.HasTaxReduction)
            {
                var reductionAmount = amount * 0.30m;
                amount = amount * 0.70m;
                await _skatteverketService.ApplyForReduction(invoiceCustomer.Name, reductionAmount);
            }

            _invoicePrinter.PrintInvoice(invoiceEmployee.Name, invoiceCustomer.Address, amount);

            await _commandBus.PublishAsync(new InvoiceSendCommand(InvoiceId.With(request.InvoiceId)), CancellationToken.None);
        }
Exemple #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (InvoiceId != null ? InvoiceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ InvoiceNumber;
         hashCode = (hashCode * 397) ^ (InvoiceNumberAsString != null ? InvoiceNumberAsString.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Total.GetHashCode();
         hashCode = (hashCode * 397) ^ Subtotal.GetHashCode();
         hashCode = (hashCode * 397) ^ Tax.GetHashCode();
         hashCode = (hashCode * 397) ^ TaxPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ InvoiceDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (ContractName != null ? ContractName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PeriodStartDate.GetHashCode();
         hashCode = (hashCode * 397) ^ PeriodEndDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (From != null ? From.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LineItems?.Sum(x => x.GetHashCode()) ?? 0);
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (invoiceId_ != null)
            {
                hash ^= InvoiceId.GetHashCode();
            }
            if (reservationId_ != null)
            {
                hash ^= ReservationId.GetHashCode();
            }
            if (amount_ != null)
            {
                hash ^= Amount.GetHashCode();
            }
            if (payment_ != null)
            {
                hash ^= Payment.GetHashCode();
            }
            if (taxes_ != null)
            {
                hash ^= Taxes.GetHashCode();
            }
            if (fees_ != null)
            {
                hash ^= Fees.GetHashCode();
            }
            if (charges_ != null)
            {
                hash ^= Charges.GetHashCode();
            }
            if (Voided != false)
            {
                hash ^= Voided.GetHashCode();
            }
            return(hash);
        }
        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);
        }
Exemple #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsDuplicateInvoiceNo())
            {
                lblMessage.Text = string.Format("The Invoice No {0} already exist. Please try with another Invoice No", txtInvoiceNo.Text);
                return;
            }

            using (TheFacade facade = new TheFacade())
            {
                if (InvoiceId <= 0)
                {
                    Inv_Master invoice = new Inv_Master();
                    invoice.CurrencyId = Convert.ToInt32(ddlCurrency.SelectedValue);
                    //invoice.Date = Convert.ToDateTime(txtDate.Text);

                    //DateTime dt = DateTime.ParseExact(txtDate.Text, "dd/M/yyyy", CultureInfo.InvariantCulture);
                    //invoice.Date = dt;//
                    invoice.Date = Convert.ToDateTime(txtDate.Text);

                    invoice.DollarAmount          = 0;//will be updated later
                    invoice.DollarCounversionRate = Convert.ToDecimal(txtConversionRate.Text);
                    invoice.Number = txtInvoiceNo.Text;

                    invoice.CreateBy   = 1;//sustemuserid
                    invoice.CreateDate = DateTime.Now;
                    invoice.IsRemoved  = 0;
                    invoice.UpdateBy   = 1;//sustemuserid
                    invoice.UpdateDate = DateTime.Now;
                    invoice.MemberId   = MemberID;
                    invoice.ExportedLocalItemDescription           = txtLocalItemDescription.Text;
                    invoice.ExportedLocalItemQuantity              = txtLoacItemQuantity.Text;
                    invoice.ExportedLocalItemAmount                = Convert.ToDecimal(txtLocalItemAmount.Text);
                    invoice.ExportedLocalDistrubuterNameAndAddress = txtLocalDistrubuterNameAndAddress.Text;
                    invoice.CountryID = Convert.ToInt64(ddlCountry.SelectedValue.ToString());
                    try {
                        facade.Insert <Inv_Master>(invoice);

                        SaveUpdateInvoiceDetail(invoice.IID, facade);
                        InvoiceId = invoice.IID;
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Contains("Violation of UNIQUE KEY constraint"))
                        {
                            lblMessage.Text = "Please Insert Unique Invoice Number";
                        }
                        else
                        {
                            lblMessage.Text = "Data Not Successfully Saved";
                        }
                    }
                }
                else
                {
                    Inv_Master invoice = facade.InvoiceFacade.GetInvoiceByIDForUpdate(InvoiceId);

                    invoice.CurrencyId = Convert.ToInt32(ddlCurrency.SelectedValue);

                    //DateTime dt = DateTime.ParseExact(txtDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    //invoice.Date = dt;// Convert.ToDateTime(txtDate.Text);
                    invoice.Date                  = Convert.ToDateTime(txtDate.Text);
                    invoice.DollarAmount          = 0;;//will be updated later
                    invoice.DollarCounversionRate = Convert.ToDecimal(txtConversionRate.Text);
                    invoice.Number                = txtInvoiceNo.Text;

                    invoice.UpdateBy   = 1;//sustemuserid
                    invoice.UpdateDate = DateTime.Now;
                    invoice.MemberId   = MemberID;
                    invoice.ExportedLocalItemDescription           = txtLocalItemDescription.Text;
                    invoice.ExportedLocalItemQuantity              = txtLoacItemQuantity.Text;
                    invoice.ExportedLocalItemAmount                = Convert.ToDecimal(txtLocalItemAmount.Text);
                    invoice.ExportedLocalDistrubuterNameAndAddress = txtLocalDistrubuterNameAndAddress.Text;
                    invoice.CountryID = Convert.ToInt64(ddlCountry.SelectedValue.ToString());
                    facade.Update <Inv_Master>(invoice);
                    SaveUpdateInvoiceDetail(invoice.IID, facade);
                }

                UpdateDollarAmount(facade, InvoiceId);
            }

            //Response.Redirect(Request.Url.ToString());
            //SHUVO
            string redirectUrl = Request.Url.GetLeftPart(UriPartial.Path).ToString() + "?invId=" + InvoiceId.ToString();

            Response.Redirect(redirectUrl);
        }
Exemple #11
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            if (fuEnclosedDoc.HasFile && !string.IsNullOrEmpty(txtDocumentName.Text))
            {
                string fileExtention = Path.GetExtension(fuEnclosedDoc.FileName);

                string path     = string.Format("~/MemberData/InvoiceEnclosedDocument/{0}/", InvoiceId.ToString());
                string fileName = Server.MapPath(path) + txtDocumentName.Text + fileExtention;
                if (CurrentDocumentID <= 0)
                {
                    try
                    {
                        if (!Directory.Exists(Server.MapPath(path)))
                        {
                            Directory.CreateDirectory(Server.MapPath(path));
                        }

                        fuEnclosedDoc.SaveAs(fileName);
                        using (TheFacade facade = new TheFacade())
                        {
                            Ins_InvoiceEnclosedDocument document = new Ins_InvoiceEnclosedDocument();
                            document.Name        = txtDocumentName.Text;
                            document.FileName    = txtDocumentName.Text + fileExtention;
                            document.Path        = path + document.FileName;
                            document.InvoiceID   = InvoiceId;
                            document.CreatedDate = DateTime.Now;
                            facade.Insert <Ins_InvoiceEnclosedDocument>(document);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    using (TheFacade facade = new TheFacade())
                    {
                        Ins_InvoiceEnclosedDocument document = facade.InsentiveFacade.GetInvoiceEnclosedDocumentByID(CurrentDocumentID);
                        string existingFile = Server.MapPath(path) + document.FileName;
                        if (File.Exists(existingFile))
                        {
                            File.Delete(existingFile);
                        }
                        if (!Directory.Exists(Server.MapPath(path)))
                        {
                            Directory.CreateDirectory(Server.MapPath(path));
                        }
                        fuEnclosedDoc.SaveAs(fileName);
                        document.Name        = txtDocumentName.Text;
                        document.FileName    = txtDocumentName.Text + fileExtention;
                        document.Path        = path + document.FileName;
                        document.InvoiceID   = InvoiceId;
                        document.CreatedDate = DateTime.Now;
                        facade.Update <Ins_InvoiceEnclosedDocument>(document);
                    }
                }
            }
            //CurrentDocumentID = 0;
            //txtDocumentName.Text = string.Empty;
            //LoadInvoiceEnclosedDocument();
            Response.Redirect(Request.Url.ToString());
        }
Exemple #12
0
 public async Task SendInvoice(SendInvoiceRequest request)
 {
     await _commandBus.PublishAsync(new InvoiceSendCommand(InvoiceId.With(request.InvoiceId)),
                                    CancellationToken.None);
 }
 public void MergeFrom(ReservationInvoiceMapping other)
 {
     if (other == null)
     {
         return;
     }
     if (other.invoiceId_ != null)
     {
         if (invoiceId_ == null)
         {
             invoiceId_ = new global::HOLMS.Types.Primitive.Uuid();
         }
         InvoiceId.MergeFrom(other.InvoiceId);
     }
     if (other.reservationId_ != null)
     {
         if (reservationId_ == null)
         {
             reservationId_ = new global::HOLMS.Types.Booking.Indicators.ReservationIndicator();
         }
         ReservationId.MergeFrom(other.ReservationId);
     }
     if (other.amount_ != null)
     {
         if (amount_ == null)
         {
             amount_ = new global::HOLMS.Types.Primitive.MonetaryAmount();
         }
         Amount.MergeFrom(other.Amount);
     }
     if (other.payment_ != null)
     {
         if (payment_ == null)
         {
             payment_ = new global::HOLMS.Types.Primitive.MonetaryAmount();
         }
         Payment.MergeFrom(other.Payment);
     }
     if (other.taxes_ != null)
     {
         if (taxes_ == null)
         {
             taxes_ = new global::HOLMS.Types.Primitive.MonetaryAmount();
         }
         Taxes.MergeFrom(other.Taxes);
     }
     if (other.fees_ != null)
     {
         if (fees_ == null)
         {
             fees_ = new global::HOLMS.Types.Primitive.MonetaryAmount();
         }
         Fees.MergeFrom(other.Fees);
     }
     if (other.charges_ != null)
     {
         if (charges_ == null)
         {
             charges_ = new global::HOLMS.Types.Primitive.MonetaryAmount();
         }
         Charges.MergeFrom(other.Charges);
     }
     if (other.Voided != false)
     {
         Voided = other.Voided;
     }
 }
 public void MergeFrom(GroupBookingInvoiceMapping other)
 {
     if (other == null)
     {
         return;
     }
     if (other.groupBookingId_ != null)
     {
         if (groupBookingId_ == null)
         {
             groupBookingId_ = new global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator();
         }
         GroupBookingId.MergeFrom(other.GroupBookingId);
     }
     if (other.InvoiceNumber != 0)
     {
         InvoiceNumber = other.InvoiceNumber;
     }
     if (other.invoiceId_ != null)
     {
         if (invoiceId_ == null)
         {
             invoiceId_ = new global::HOLMS.Types.Primitive.Uuid();
         }
         InvoiceId.MergeFrom(other.InvoiceId);
     }
     if (other.Voided != false)
     {
         Voided = other.Voided;
     }
     if (other.createdBy_ != null)
     {
         if (createdBy_ == null)
         {
             createdBy_ = new global::HOLMS.Types.IAM.StaffMember();
         }
         CreatedBy.MergeFrom(other.CreatedBy);
     }
     if (other.voidedBy_ != null)
     {
         if (voidedBy_ == null)
         {
             voidedBy_ = new global::HOLMS.Types.IAM.StaffMember();
         }
         VoidedBy.MergeFrom(other.VoidedBy);
     }
     if (other.voidedAt_ != null)
     {
         if (voidedAt_ == null)
         {
             voidedAt_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         VoidedAt.MergeFrom(other.VoidedAt);
     }
     if (other.createdAt_ != null)
     {
         if (createdAt_ == null)
         {
             createdAt_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         CreatedAt.MergeFrom(other.CreatedAt);
     }
 }