Skip to content

Commit

Permalink
Merge pull request #1 from postprime/trung/payout_at_one
Browse files Browse the repository at this point in the history
Payout at one
  • Loading branch information
chunvv authored Oct 19, 2021
2 parents abed19d + 91a151e commit 039ec85
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 28 deletions.
14 changes: 2 additions & 12 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,11 @@ func (d *Document) appendTotal(pdf *gofpdf.Fpdf) {
pdf.SetX(102)
pdf.SetFillColor(GreyBgColor[0], GreyBgColor[1], GreyBgColor[2])
pdf.Rect(100, pdf.GetY(), 40, 10, "F")
pdf.CellFormat(40, 10, formatAmount(d.PaidAmount1.Amount), "0", 0, "L", false, 0, "")
pdf.CellFormat(40, 10, formatAmount(d.PaidAmount.Amount), "0", 0, "L", false, 0, "")

pdf.SetX(30)
pdf.SetFillColor(GreyBgColor[0], GreyBgColor[1], GreyBgColor[2])
pdf.Rect(20, pdf.GetY(), 80, 10, "F")
pdf.CellFormat(60, 10, encodeString(d.Options.Payout1+" "+d.PaidAmount1.PayoutDate), "0", 0, "R", false, 0, "")
pdf.CellFormat(60, 10, encodeString(d.Options.Payout+" "+d.PaidAmount.PayoutDate), "0", 0, "R", false, 0, "")
pdf.SetY(pdf.GetY() + 11)

pdf.SetX(102)
pdf.SetFillColor(GreyBgColor[0], GreyBgColor[1], GreyBgColor[2])
pdf.Rect(100, pdf.GetY(), 40, 10, "F")
pdf.CellFormat(40, 10, formatAmount(d.PaidAmount2.Amount), "0", 0, "L", false, 0, "")

pdf.SetX(30)
pdf.SetFillColor(GreyBgColor[0], GreyBgColor[1], GreyBgColor[2])
pdf.Rect(20, pdf.GetY(), 80, 10, "F")
pdf.CellFormat(60, 10, encodeString(d.Options.Payout2+" "+d.PaidAmount2.PayoutDate), "0", 0, "R", false, 0, "")
}
9 changes: 0 additions & 9 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,3 @@ func (d *Document) SetPaidAmount(paidAmount *PaidAmount) *Document {
d.PaidAmount = paidAmount
return d
}

func (d *Document) SetPaidAmount1(paidAmount *PaidAmount) *Document {
d.PaidAmount1 = paidAmount
return d
}
func (d *Document) SetPaidAmount2(paidAmount *PaidAmount) *Document {
d.PaidAmount2 = paidAmount
return d
}
2 changes: 0 additions & 2 deletions document.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ type Document struct {
WithholdingTax *WithholdingTax `json:"withholding_tax,omitempty"`
PaymentFree *PaymentFree `json:"payment_free,omitempty"`
PaidAmount *PaidAmount `json:"paid_amount,omitempty"`
PaidAmount1 *PaidAmount `json:"paid_amount_1,omitempty"`
PaidAmount2 *PaidAmount `json:"paid_amount_2,omitempty"`
}
4 changes: 1 addition & 3 deletions generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func TestNew(t *testing.T) {
doc.SetAfterCommission(&AfterCommission{Amount: 630000, ConsumptionTax: 64545, IsDomesticCreator: true})
doc.SetWithholdingTax(&WithholdingTax{Amount: 64323})
doc.SetPaymentFree(&PaymentFree{Amount: 35244})
doc.SetPaidAmount(&PaidAmount{Amount: 593433})
doc.SetPaidAmount1(&PaidAmount{Amount: 304050, PayoutDate: "2021年11月30日"})
doc.SetPaidAmount2(&PaidAmount{Amount: 304050, PayoutDate: "2021年12月31日"})
doc.SetPaidAmount(&PaidAmount{Amount: 593433, PayoutDate: "2021年11月30日"})

pdf, err := doc.Build()
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ type Options struct {
TextPaymentTotal string `default:"決済手数料" json:"text_payment_total,omitempty"`
TextWithholdingTaxTotal string `default:"源泉所得税" json:"text_withholding_tax_total,omitempty"`
TextTotalTotal string `default:"お支払い金額" json:"text_total_total,omitempty"`
Payout1 string `default:"第1回支払予定日" json:"payout_1,omitempty"`
Payout2 string `default:"第2回支払予定日" json:"payout_2,omitempty"`
Payout string `default:"支払予定日" json:"payout,omitempty"`
}
Binary file modified payment_details_example.pdf
Binary file not shown.

0 comments on commit 039ec85

Please sign in to comment.