Header S, G, N, H parameters added

This commit is contained in:
2024-05-23 08:45:10 +03:00
parent 06a2175726
commit 88bdbb969d
3 changed files with 112 additions and 6 deletions

View File

@@ -8,4 +8,14 @@ type LucaBordro struct {
TcNo string
AdSoyad string
Ucretler map[string]decimal.Decimal
//Header map[string]string
}
type BordroPageSelectBoxType struct {
B string
N string
}
const (
BIndex = "B"
NIndex = "N"
)

View File

@@ -33,6 +33,11 @@ type BordroPageScript struct {
Index string
Value string
itemType string
DomSelectValue struct {
Index string
Value string
itemType string
}
}
func (l *Luca) ErrFunc(index bool) {
@@ -348,6 +353,16 @@ func (l *Luca) BordroTableMaping(frame *rod.Page, b *LucaBordro) ([]BordroPageSc
} else {
if t <= len(table)-2 {
if text != "" {
if mainText == "N\nB" {
aa, err := table[t].Element("select")
id, err := aa.Attribute("id")
dd := len(scriptIndexArray) - 2
scriptIndexArray[dd].DomSelectValue.Index = *id
scriptIndexArray[dd].DomSelectValue.Value = mainText
scriptIndexArray[dd].DomSelectValue.itemType = "select"
fmt.Print(aa, id, err)
}
inputBox, err := table[t+1].Element("input")
selectBox, err := table[t+1].Element("select")
fmt.Print(err)
@@ -627,6 +642,8 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
break
}
for k, v := range b.Ucretler {
splitValue := strings.SplitN(k, " #", 2)
k = strings.TrimSpace(splitValue[0])
var elementInsertControl bool = true
var displayControl bool = true
tt := v.String()
@@ -637,6 +654,11 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
for i := 0; i < len(rsp); i++ {
if k == rsp[i].Value {
var hashValue string
if len(splitValue) > 1 {
hashValue = strings.TrimSpace(splitValue[1])
fmt.Println(hashValue)
}
Wait(frame3, 200)
if rsp[i].itemType == "selectBox" {
elemBox, err := frame3.Element("#" + rsp[i].Index)
@@ -655,12 +677,40 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
if err != nil {
return err
}
// //s ve g olunca i yi çalıştır n ve b olunca i+1 i
if hashValue == "S" || hashValue == "G" {
el, err = frame3.Element("#" + rsp[i].Index)
if err != nil {
return err
}
}
if hashValue == "B" || hashValue == "N" {
if strings.Contains(rsp[i].Index, "Carpan") {
b := BordroPageSelectBoxType{
B: "1", // Buraya gerçek değeri koyun
N: "0", // Buraya gerçek değeri koyun
}
var dynamicValue string
if hashValue == "B" {
dynamicValue = b.B
} else {
dynamicValue = b.N
}
elemBox, err := frame3.Element("#" + rsp[i].DomSelectValue.Index)
if err != nil {
return err
}
selectInput = Select{Element: elemBox, Selector: "#" + rsp[i].DomSelectValue.Index}
err = selectInput.SelectItem(dynamicValue)
if err != nil {
return err
}
el, err = frame3.Element("#" + rsp[i+1].Index)
if err != nil {
return err
}
}
}
value := v.String()
if strings.Contains(value, ".") {
value = strings.Replace(value, ".", ",", -1)

View File

@@ -128,11 +128,54 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
TcNo: rows[i][2],
AdSoyad: rows[i][3],
Ucretler: make(map[string]decimal.Decimal),
//Header: make(map[string]string),
}
var status bool = false
//var ExcelError string
for ndx, col := range rows[i] {
if ndx > 3 {
key := rows[0][ndx]
if strings.Contains(key, "#") {
keySplit := strings.SplitN(key, " #", 2)
keySplitOne := strings.TrimSpace(keySplit[0])
tseK := strings.TrimSpace(keySplit[1])
fmt.Print(tseK)
for k, _ := range brd.Ucretler {
if strings.Contains(k, keySplitOne) { //k=olan
if strings.Contains(k, "B") && strings.Contains(tseK, "N") {
emitLog("Şube : aynı anda B ve N Sütunu Girilemez ")
status = true
break
}
if strings.Contains(k, "N") && strings.Contains(tseK, "B") {
emitLog("Şube : aynı anda N ve B Sütunu Girilemez ")
status = true
break
}
if strings.Contains(k, "G") && strings.Contains(tseK, "S") {
emitLog("Şube : aynı anda G ve S Sütunu Girilemez ")
status = true
break
}
if strings.Contains(k, "S") && strings.Contains(tseK, "G") {
emitLog("Şube : aynı anda S ve G Sütunu Girilemez ")
status = true
break
}
}
}
if status {
break
}
}
brd.Ucretler[key], err = decimal.NewFromString(col)
if err != nil {
if strings.Contains(col, ",") {
@@ -147,6 +190,9 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
}
}
}
if status {
break
}
if i == len(rows)-1 {
lastItem = true
}