page mapping was done

This commit is contained in:
hysn99
2024-04-02 17:52:24 +03:00
parent 321a76096f
commit a415c8ad92
3 changed files with 577 additions and 196 deletions

View File

@@ -3,11 +3,11 @@ package srv
import (
"bordrobot/lib/bot"
"bordrobot/lib/company"
"bordrobot/lib/model"
"bordrobot/lib/run"
"fmt"
"log/slog"
"github.com/shopspring/decimal"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/xuri/excelize/v2"
)
@@ -51,16 +51,6 @@ type userInfo struct {
accountNo string
}
func getUser(userId string) *userInfo {
// user, ok := userDB[userId]
//
// if !ok {
// return nil
// }
info := userInfo{accountNo: "3197485", userName: "NOTİTEK01", password: "Notitek2025."}
//info := userInfo{accountNo: "3197485", userName: "NOTİTEK01", password: "sdaasd."}
return &info
}
func (s *Srv) Rpa(companyName string, month float64, year float64) error {
type CompanyInfo struct {
company *company.Company // float64.Company türünü gömme
@@ -112,14 +102,33 @@ func (s *Srv) Rpa(companyName string, month float64, year float64) error {
if rows[0][0] == "" {
rows = rows[1:]
}
data := make([]*model.Bordro, 0) // []*Bordro türünde bir dilim oluştur
// data := make([]*model.Bordro, 0) // []*Bordro türünde bir dilim oluştur
for i := 1; i < len(rows); i++ {
bordroSatiri, err := model.NewFromExcelLine(rows[i])
data = append(data, bordroSatiri)
//
fmt.Println(bordroSatiri, err)
brd := &bot.LucaBordro{
Sube: rows[i][0],
Bolum: rows[i][1],
TcNo: rows[i][2],
AdSoyad: rows[i][3],
Ucretler: make(map[string]decimal.Decimal),
}
for ndx, col := range rows[i] {
if ndx > 3 {
key := rows[0][ndx]
brd.Ucretler[key], err = decimal.NewFromString(col)
if err != nil {
//todo: kullanıcıya hata logu ver
//veya tekrar okuma denebilinir
fmt.Println(err)
}
}
}
err = b.BordroYazPage(int(month), int(year), brd)
}
err = b.BordroYaz(data, month, year)
if err != nil {
//emitLog(err.message)
return err