package erp import ( "context" "time" "git.kumo.work/shama/service/client" expense2 "git.kumo.work/shama/service/erp/expense" "git.kumo.work/shama/service/lib/bean" "github.com/shopspring/decimal" ) type expense struct { expense2.Expense } type ArgsExpenseList struct { Page bean.Page Search ExpenseSearch } type ExpenseSearch struct { ExpenseSerial string // 报销单号 CreatedAtStart *time.Time // 创建开始时间 CreatedAtEnd *time.Time // 创建结束时间 } type ReplyExpenseList struct { List []ExpenseItem `json:"list"` Total int64 `json:"total"` } type ExpenseItem struct { Id int64 `json:"id"` ExpenseSerial string `json:"expenseSerial"` Currency string `json:"currency"` CurrencyName string `json:"currencyName"` CurrencySymbol string `json:"currencySymbol"` CurrencyRate decimal.Decimal `json:"currencyRate"` Remarks string `json:"remarks"` Amount decimal.Decimal `json:"amount"` CreatedStaffId int64 `json:"createdStaffId"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` } // List @TITLE 列表 func (r *expense) List(ctx context.Context, args ArgsExpenseList) (reply ReplyExpenseList, err error) { xClient, err := client.GetClient(r) if err != nil { return } err = xClient.Call(ctx, "List", args, &reply) return } type ArgsExpenseAdd struct { StaffId int64 ExpenseAdd } type ExpenseAdd struct { Currency string // 币种 CurrencyName string // 币种名称 CurrencySymbol string // 币种符号 CurrencyRate decimal.Decimal // 币种汇率 Remarks string // 备注 Amount decimal.Decimal // 金额 } // Add @TITLE 添加 func (r *expense) Add(ctx context.Context, args ArgsExpenseAdd) (expenseId int64, err error) { xClient, err := client.GetClient(r) if err != nil { return } err = xClient.Call(ctx, "Add", args, &expenseId) return } type ReplyExpenseInfo struct { Id int64 `json:"id"` ExpenseSerial string `json:"expenseSerial"` Currency string `json:"currency"` CurrencyName string `json:"currencyName"` CurrencySymbol string `json:"currencySymbol"` CurrencyRate decimal.Decimal `json:"currencyRate"` Amount decimal.Decimal `json:"amount"` Remarks string `json:"remarks"` CreatedStaffId int64 `json:"createdStaffId"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` } // Info @TITLE 详情 func (r *expense) Info(ctx context.Context, expenseId int64) (reply ReplyExpenseInfo, err error) { xClient, err := client.GetClient(r) if err != nil { return } err = xClient.Call(ctx, "Info", expenseId, &reply) return } type ArgsExpenseEdit struct { ExpenseId int64 ExpenseAdd } // Edit @TITLE 编辑 func (r *expense) Edit(ctx context.Context, args ArgsExpenseEdit) (err error) { xClient, err := client.GetClient(r) if err != nil { return } reply := 0 return xClient.Call(ctx, "Edit", args, &reply) }