本文整理汇总了C#中Invoice类的典型用法代码示例。如果您正苦于以下问题:C# Invoice类的具体用法?C# Invoice怎么用?C# Invoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Invoice类属于命名空间,在下文中一共展示了Invoice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCostEstimateByWeight
internal float GetCostEstimateByWeight(float weight, Carrier carrier, Parcel parcel, Invoice invoice)
{
float estimate = 0;
int intPostcode = 0;
int.TryParse(invoice.InvoiceCustomer.Postcode, out intPostcode);
BlauModel _dbcontext = BlauModel.GetContext();
DBCarrier _carrier = _dbcontext.Carrier.Where(x => x.carrierId == (int)carrier.CarrierId).FirstOrDefault();
if (_carrier != default(DBCarrier))
{
/*PricingOption option = (from rate in _carrier.Rates
where rate.Zones.Where(x => x.Postcode == invoice.InvoiceCustomer.Postcode).Count() > 0
&& rate.MinWeight < weight && rate.MaxWeight >= weight
select new PricingOption(rate.Rate, rate.ExtraRate, rate.MinWeight, rate.MaxWeight, rate.SecondRate, rate.SecondRateExtra)
).FirstOrDefault();
if (option != null)
{
if (parcel.ParcelNumber == 1)
estimate = option.rate + option.extra_rate * weight;
else
estimate = option.second_parcel_rate + option.second_parcel_extra_rate * weight;
}*/
}
return estimate;
}
示例2: Index
public ActionResult Index(QueryInvoiceViewModel model)
{
//1. 設定開立發票資訊
QueryInvoice qinv = new QueryInvoice();
qinv.MerchantID = model.MerchantID;
qinv.RelateNumber = model.RelateNumber;
//2. 初始化發票Service物件
Invoice<QueryInvoice> inv = new Invoice<QueryInvoice>();
//3. 指定測試環境, 上線時請記得改Prod
inv.Environment = EInvoice.Integration.Enumeration.EnvironmentEnum.Stage;
//4. 設定歐付寶提供的 Key 和 IV
inv.HashIV = "q9jcZX8Ib9LM8wYk";
inv.HashKey = "ejCk326UnaZWKisg";
//5. 執行API的回傳結果(JSON)字串
string json = inv.post(qinv);
//6. 解序列化,還原成物件使用
//QueryInvoiceReturn obj = new QueryInvoiceReturn();
//obj = JsonConvert.DeserializeObject<QueryInvoiceReturn>(json);
//obj.XXX;
//obj.XXX;
// ...
ViewBag.message = json;
return View();
}
示例3: AddInvoice
public int AddInvoice(Invoice invoice)
{
DbParameter parameter = null;
parameter = Db.CreateParameter("InvoiceId", DbType.Int32, 8);
parameter.Direction = ParameterDirection.Output;
Db.ExecuteNonQuery("usp_Invoice_InsertInvoiceDetails", CommandType.StoredProcedure,
new DbParameter[] {
parameter,
Db.CreateParameter("CompanyId", invoice.CompanyId),
Db.CreateParameter("ClientId", invoice.ClientId),
Db.CreateParameter("IssueDate", invoice.IssueDate),
Db.CreateParameter("PurchaseOrderNo", invoice.PurchaseOrderNo),
Db.CreateParameter("PaymentTermId", invoice.PaymentTermId),
Db.CreateParameter("DueDate", invoice.DueDate),
Db.CreateParameter("Discount", invoice.Discount),
Db.CreateParameter("RoundOffTotal", invoice.RoundOffTotal),
Db.CreateParameter("MarkInvoicePaid", invoice.MarkInvoicePaid),
Db.CreateParameter("PaymentTypeId", invoice.PaymentTypeId),
Db.CreateParameter("AmountPaid", invoice.AmountPaid),
Db.CreateParameter("PaymentDate", invoice.PaymentDate),
Db.CreateParameter("PaymentStatus", invoice.PaymentStatus),
Db.CreateParameter("Notes", invoice.Notes),
Db.CreateParameter("TotalAmount", invoice.TotalAmount),
Db.CreateParameter("NotesForClient", invoice.NotesForClient),
Db.CreateParameter("PrivateNotes", invoice.PrivateNotes),
Db.CreateParameter("Status", invoice.Status)
});
return (int)parameter.Value;
}
示例4: OrderDocument
public OrderDocument(Order order, Invoice invoices, List<Receipt> receipts)
{
_Order = order;
_Invoices = invoices;
Receipts = receipts;
CalcAmountPaid();
}
示例5: PopulateInvoiceParam
/// <summary>
/// This function is responsible for populating the
/// parameters required for generating a invoice.
/// </summary>
/// <param name="invoicedto"></param>
/// <param name="timeActivity"></param>
/// <returns></returns>
private Invoice PopulateInvoiceParam(Invoicedto invoicedto, TimeActivity timeActivity)
{
Invoice invoice = new Invoice();
invoice.TxnDate = timeActivity.TxnDate;
invoice.Line = new Line[]
{
new Line{AmountSpecified=true,Description=timeActivity.Description,Amount=25,DetailType=LineDetailTypeEnum.SalesItemLineDetail,DetailTypeSpecified=true,AnyIntuitObject = new SalesItemLineDetail{Qty=Convert.ToDecimal(3.5),TaxCodeRef=new ReferenceType{Value="NON"},ItemRef=new ReferenceType{Value=timeActivity.ItemRef.Value}}},
new Line{Amount=25,AmountSpecified=true,DetailType=LineDetailTypeEnum.SubTotalLineDetail,DetailTypeSpecified=true,AnyIntuitObject = new SubTotalLineDetail{}}
};
invoice.TxnTaxDetail = new TxnTaxDetail { TotalTax = 0 };
invoice.CustomerRef = new ReferenceType { Value = timeActivity.CustomerRef.Value };
invoice.DueDate = DateTime.Now;
invoice.TotalAmt = 25;
invoice.ApplyTaxAfterDiscount = false;
invoice.PrintStatus = PrintStatusEnum.NeedToPrint;
invoice.PrintStatusSpecified = true;
invoice.EmailStatus = EmailStatusEnum.NotSet;
invoice.EmailStatusSpecified = true;
invoice.Balance = 25;
invoice.BalanceSpecified = true;
invoice.Deposit = 0;
invoice.DepositSpecified = true;
invoice.AllowIPNPayment = false;
invoice.AllowIPNPaymentSpecified = true;
invoice.AllowOnlinePayment = false;
invoice.AllowOnlinePaymentSpecified = true;
invoice.AllowOnlineCreditCardPayment = false;
invoice.AllowOnlineCreditCardPaymentSpecified = true;
invoice.AllowOnlineACHPayment = false;
invoice.AllowOnlineACHPaymentSpecified = true;
return invoice;
}
示例6: Index
public ActionResult Index(AllowanceInvalidViewModel Model)
{
//1. 設定開立折讓作廢資訊
AllowanceInvalid invc = new AllowanceInvalid();
invc.MerchantID = Model.MerchantID;
invc.InvoiceNo = Model.InvoiceNo;
invc.AllowanceNo = Model.AllowanceNo;
invc.Reason = Model.Reason;
//2. 初始化發票Service物件
Invoice<AllowanceInvalid> inv = new Invoice<AllowanceInvalid>();
//3. 指定測試環境, 上線時請記得改Prod
inv.Environment = EInvoice.Integration.Enumeration.EnvironmentEnum.Stage;
//4. 設定歐付寶提供的 Key 和 IV
inv.HashIV = "q9jcZX8Ib9LM8wYk";
inv.HashKey = "ejCk326UnaZWKisg";
//5. 執行API的回傳結果(JSON)字串
string json = inv.post(invc);
//6. 解序列化,還原成物件使用
//AllowanceInvalidReturn obj = new AllowanceInvalidReturn();
//obj = JsonConvert.DeserializeObject<AllowanceInvalidReturn>(json);
//obj.XXX;
// ...
ViewBag.message = json;
return View();
}
示例7: CalculateFor
public double CalculateFor(Invoice invoice)
{
var invoiceTotaler = new InvoiceTotaler();
var total = invoiceTotaler.CalculateFor(invoice);
total = total * 1.05;
return total;
}
示例8: CreateContractInvoice
public InvoiceViewModel CreateContractInvoice(InvoiceViewModel invoice, int contractId)
{
var newInvoice = new Invoice
{
Id = invoice.Id,
From = invoice.From,
To = invoice.To,
MgSubs = invoice.MgSubs,
Cps = invoice.Cps,
CreatedOn = DateTime.Now,
CorrespondencePayment = invoice.CorrespondencePayment,
AdditionalInformation = invoice.AdditionalInformation,
FixedMonthlyFee = invoice.FixedMonthlyFee,
Vat = invoice.Vat,
ClientContractId = contractId,
Comments = invoice.Comments,
IsPaid = false,
IsVisible = invoice.IsVisible
};
this.Data.Invoices.Add(newInvoice);
this.Data.SaveChanges();
invoice.Id = newInvoice.Id;
return invoice;
}
示例9: SetInvoiceInfo
protected void SetInvoiceInfo(Invoice invoice, bool initialSetting)
{
string invoiceViewURL = "/Invoice_ViewV2.aspx?invoice_id=" + invoice.InvoiceID;
lblInvoiceID.Text = "<a href=\"" + invoiceViewURL + "\" onclick=\"open_new_tab('" + invoiceViewURL + "');return false;\">" + invoice.InvoiceID + "</a>";
lblInvoiceTotal.Text = "$" + invoice.Total.ToString();
lblInvoiceOwing.Text = "$" + invoice.TotalDue.ToString();
lblReceiptedTotal.Text = "$" + invoice.ReceiptsTotal.ToString() + (invoice.CreditNotesTotal == 0 ? "" : " ($" + invoice.CreditNotesTotal.ToString() + " Credit Noted)") + (invoice.RefundsTotal == 0 ? "" : " ($" + invoice.RefundsTotal.ToString() + " Refunds)");
hiddenInvoiceOwingTotalCents.Value = ((int)(invoice.TotalDue * 100)).ToString();
hiddenReceiptedAmountTotalCents.Value = ((int)(invoice.ReceiptsTotal * 100)).ToString();
Page.ClientScript.RegisterStartupScript(this.GetType(), "setamount", "<script language=javascript>if (!is_debugging) document.getElementById('amount').value = '" + invoice.TotalDue.ToString() + "';</script>");
lblDebtor.Text = invoice.GetDebtor(true);
if (invoice.Booking != null)
{
lblBkDate.Text = invoice.Booking.DateStart.ToString("d MMM, yyyy");
lblBkOrgText.Text = invoice.Booking.Organisation.IsAgedCare ? "Facility" : "Clinic";
lblBkOrg.Text = invoice.Booking.Organisation.Name;
}
else
{
td_bk_date.Visible = false;
td_bk_org.Visible = false;
}
result.InnerHtml = hiddenResponse.Value;
merchantReceipt.InnerHtml = (hiddenMerchangeReceipt.Value.Length > 0) ? "<pre>" + hiddenMerchangeReceipt.Value + "</pre>" : string.Empty;
customerReceipt.InnerHtml = (hiddenCustomerReceipt.Value.Length > 0) ? "<pre>" + hiddenCustomerReceipt.Value + "</pre>" : string.Empty;
btnPrintMerchantReceipt.Style["display"] = hiddenMerchangeReceipt.Value.Length > 0 ? "" : "none";
btnPrintCustomerReceipt.Style["display"] = hiddenCustomerReceipt.Value.Length > 0 ? "" : "none";
}
示例10: Write_WithOneInvoiceAndTwoLineItems_GeneratesCorrectOutput
public void Write_WithOneInvoiceAndTwoLineItems_GeneratesCorrectOutput()
{
// Arrange
List<InvoiceLineItem> lineItems = new List<InvoiceLineItem>();
lineItems.Add(new InvoiceLineItem(100.00m, "Test item 1"));
lineItems.Add(new InvoiceLineItem(123.45m, "Test item 2"));
Invoice invoice = new Invoice(
"WEE0001",
new DateTime(2015, 1, 1),
TransactionType.Invoice,
"WEE741804H",
lineItems);
TransactionFile file = new TransactionFile("WEE", 0);
file.AddInvoice(invoice);
// Act
string result = file.Write();
// Assert
string expectedDate = DateTime.UtcNow.Date.ToString("dd-MMM-yyyy").ToUpperInvariant();
string expectedOutput =
"\"H\",\"0000000\",\"WEE\",\"H\",\"I\",\"00000\",\"\",\"" + expectedDate + "\"" + Environment.NewLine +
"\"D\",\"0000001\",\"WEE0001\",\"01-JAN-2015\",\"I\",\"WEE741804H\",\"\",\"GBP\",\"\",\"01-JAN-2015\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\","
+ "\"10000\",\"\",\"H\",\"Test item 1\",\"W\",\"H\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"1\",\"Each\",\"10000\"" + Environment.NewLine +
"\"D\",\"0000002\",\"WEE0001\",\"01-JAN-2015\",\"I\",\"WEE741804H\",\"\",\"GBP\",\"\",\"01-JAN-2015\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\","
+ "\"12345\",\"\",\"H\",\"Test item 2\",\"W\",\"H\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"1\",\"Each\",\"12345\"" + Environment.NewLine +
"\"T\",\"0000003\",\"0000004\",\"22345\",\"0\"" + Environment.NewLine;
Assert.Equal(expectedOutput, result);
}
示例11: Add
public int Add(Invoice newInvoice)
{
this.invoices.Add(newInvoice);
this.invoices.SaveChanges();
return newInvoice.Id;
}
示例12: Index
public ActionResult Index(InvoiceDelayViewModel Model)
{
//1. 設定觸發或延遲開立發票資訊
InvoiceDelay invc = new InvoiceDelay();
invc.MerchantID = Model.MerchantID;
invc.DelayFlag = Model.DelayFlag;
invc.RelateNumber = Model.RelateNumber;
invc.CustomerID = Model.CustomerID;
invc.CustomerIdentifier = Model.CustomerIdentifier;
invc.CustomerAddr = Model.CustomerAddr;
invc.CustomerName = Model.CustomerName;
invc.CustomerPhone = Model.CustomerPhone;
invc.CustomerEmail = Model.CustomerEmail;
invc.ClearanceMark = Model.ClearanceMark;
invc.TaxType = Model.TaxType;
invc.SalesAmount = Model.SalesAmount;
invc.carruerType = Model.CarruerType;
invc.CarruerNum = Model.CarruerNum;
invc.Donation = Model.Donation;
invc.LoveCode = Model.LoveCode;
invc.Print = Model.Print;
invc.Items.Add(new Item()
{
ItemName = Model.ItemName,
ItemPrice = Model.ItemPrice,
ItemCount = Model.ItemCount,
ItemWord = Model.ItemWord,
ItemAmount = Model.ItemAmount
});
invc.InvoiceRemark = Model.InvoiceRemark;
invc.DelayDay = Model.DelayDay;
invc.ECBankID = Model.ECBankID;
invc.Tsr = Model.Tsr;
invc.PayType = Model.PayType;
invc.NotifyURL = Model.NotifyURL;
invc.invType = Model.InvType;
//2. 初始化發票Service物件
Invoice<InvoiceDelay> inv = new Invoice<InvoiceDelay>();
//3. 指定測試環境, 上線時請記得改Prod
inv.Environment = EInvoice.Integration.Enumeration.EnvironmentEnum.Stage;
//4. 設定歐付寶提供的 Key 和 IV
inv.HashIV = "q9jcZX8Ib9LM8wYk";
inv.HashKey = "ejCk326UnaZWKisg";
//5. 執行API的回傳結果(JSON)字串
string json = inv.post(invc);
//6. 解序列化,還原成物件使用
//InvoiceDelayReturn obj = new InvoiceDelayReturn();
//obj = JsonConvert.DeserializeObject<QueryAllowanceReturn>(json);
//obj.XXX;
// ...
ViewBag.message = json;
return View();
}
示例13: InitializeInvoices
private void InitializeInvoices()
{
var date = DateTime.UtcNow.Date;
DesignInvoice = new Invoice
{
DueDate = date,
FixedScheduleOptionInt = (Int32)FixedScheduleOption.FirstOfMonth,
Memo = "Cleaning Grease Trap",
RelativeScheduleDays = 5,
ScheduleModeInt = (Int32)ScheduleMode.FixedDate
};
DesignInvoiceTwo = new Invoice
{
DueDate =date.AddDays(5),
FixedScheduleOptionInt = (Int32)FixedScheduleOption.MiddleOfMonth,
Memo = "Food Delivery",
RelativeScheduleDays = 10,
ScheduleModeInt = (Int32)ScheduleMode.Relative
};
DesignInvoiceThree = new Invoice
{
DueDate = date.AddDays(40),
FixedScheduleOptionInt = (Int32)FixedScheduleOption.LastOfMonth,
Memo = "Deliver Freight",
RelativeScheduleDays = 34,
ScheduleModeInt = (Int32)ScheduleMode.FixedDate
};
DesignInvoices = new List<Invoice> { DesignInvoice, DesignInvoiceTwo, DesignInvoiceThree };
}
示例14: GetCostEstimateFor
internal CostEstimate GetCostEstimateFor(Carrier carrier, Invoice invoice, Dimensions dimensions, float[] parcelWeights)
{
int numParcels = parcelWeights.Length;
CostEstimate estimate = new CostEstimate();
double weightTotal = 0.0f, sizeTotal = 0.0f;
string new_temp_city = invoice.InvoiceCustomer.City;
int parcelNumber = 1;
//int numSizeWeights = txtBox_input_dimensions.Text == "" ? 0 : txtBox_input_dimensions.Text.Split('/').Length;
// Split the weights and do separate checks for each
foreach (float weight in parcelWeights)
{
if (weight > MAXIMUM_WEIGHT)
{
throw new PricingException($"Parcel weight is larger than {MAXIMUM_WEIGHT}KGs!");
}
Parcel p = new Parcel(weight, parcelNumber, 0.0d, numParcels);
p.Size = dimensions;
API.InvoicesAPI.AddParcelToInvoice(invoice, p);
float sizeWeight = p.getSizeWeight() * carrier.DimensionWeightRate;
weightTotal += GetCostEstimate(carrier, p, invoice);
sizeTotal += sizeWeight == 0 ? 0.0f : GetCostEstimateByWeight(sizeWeight, carrier, p, invoice);
parcelNumber++;
}
return estimate;
}
示例15: btnExecute_Click
protected void btnExecute_Click(object sender, EventArgs e)
{
//Define a workbook to store null value initially
Workbook workbook = null;
string path = MapPath(".");
path = path.Substring(0, path.LastIndexOf("\\"));
Invoice invoice = new Invoice(path);
//Create the workbook based on a custom method of a class
workbook = invoice.CreateInvoice();
if (ddlFileVersion.SelectedItem.Value == "XLS")
{
////Save file and send to client browser using selected format
workbook.Save(HttpContext.Current.Response, "Invoice.xls", ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
}
else
{
workbook.Save(HttpContext.Current.Response, "Invoice.xlsx", ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsx));
}
//end response to avoid unneeded html
HttpContext.Current.Response.End();
}