Accounting - #17
Open
CZnavody19 wants to merge 8 commits into
Open
Conversation
CZnavody19
force-pushed
the
feature/accounting
branch
from
January 17, 2024 16:20
15db09a to
f9a1fa3
Compare
espeletia
requested changes
Jan 22, 2024
Comment on lines
+4
to
+5
|
|
||
| UPDATE pricelvlgroup SET commission=6 WHERE group_id IN (4,5); |
Collaborator
There was a problem hiding this comment.
These groups are not defined in other migrations, if this runs in an empty DB migrations will fail.
Collaborator
Author
There was a problem hiding this comment.
Im not sure i understand, the pricelvlgroup table is defined, the group_id column is also defined and the commission column is defined the line before.
Comment on lines
+67
to
+68
|
|
||
| func (au *AccountingUsecase) GetMenuOrders2(ctx context.Context, restaurantId int, dateFrom time.Time, dateTo time.Time) ([]*domain.MenuOrder2, error) { |
Collaborator
Author
There was a problem hiding this comment.
Renamed all "MenuOrder2" to "AccountingOrder"
Comment on lines
+20
to
+21
| type MenuOrder2 struct { | ||
| Date time.Time |
Comment on lines
+126
to
+127
|
|
||
| type MenuOrder2 struct { |
Comment on lines
+208
to
+209
|
|
||
| func (m Mapper) MapMenuOrders2(menuOrders2 []*domain.MenuOrder2) []*model.MenuOrders2 { |
Comment on lines
+193
to
+202
| // crashes when notice is null - they are nullable | ||
| func mapCashAdvanceFromDB(cashAdvance model.Bankapi) *domain.CashAdvance { | ||
| return &domain.CashAdvance{ | ||
| Id: int64(cashAdvance.ID), | ||
| Date: *cashAdvance.Date, | ||
| VariableSymbol: int64(*cashAdvance.Variablesym), | ||
| Amount: int64(cashAdvance.Amount), | ||
| Notice: getStringOrNil(cashAdvance.Notice), | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
If notice is nil, then make the notice field a pointer...
Comment on lines
+204
to
+210
| // this prevents crashes | ||
| func getStringOrNil(value *string) string { | ||
| if value == nil { | ||
| return "" | ||
| } | ||
| return (*value) | ||
| } |
Comment on lines
+48
to
+49
| OrderedMeals: -orderedMeals, | ||
| EndAdvance: startAdvance + float64(acceptedAdvance) - orderedMeals, |
Collaborator
Author
There was a problem hiding this comment.
the database returns a positive value but in the accounting it should be showcased as a negative
| func (adbs *AccountingDatabaseStore) GetAcceptedAdvance(ctx context.Context, dateFrom time.Time, dateTo time.Time) (int, error) { | ||
| stmt := postgres.SELECT(postgres.SUM(table.Bankapi.Amount)). | ||
| FROM(table.Bankapi). | ||
| WHERE(table.Bankapi.Amount.GT(postgres.Int(0)).AND(table.Bankapi.Date.BETWEEN(postgres.Date(dateFrom.Year(), dateFrom.Month(), dateFrom.Day()), postgres.Date(dateTo.Year(), dateTo.Month(), dateTo.Day())))) |
Collaborator
There was a problem hiding this comment.
money that we have accepted has a status of 1
Comment on lines
+13
to
+14
| Notice: String! | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.