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

@@ -30,9 +30,14 @@ type errorInfo struct {
Index int
}
type BordroPageScript struct {
Index string
Value string
itemType string
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
}
if strings.Contains(rsp[i].Index, "Carpan") {
el, err = frame3.Element("#" + rsp[i+1].Index)
// //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)