s and g , n and b distinction was made

This commit is contained in:
2024-05-23 17:18:09 +03:00
parent 88bdbb969d
commit ac071a8cda
2 changed files with 102 additions and 19 deletions

View File

@@ -118,6 +118,49 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
}
// if rows[0][0] == "" {
// rows = rows[1:]
// }
// type hashtagValue struct {
// B string
// N string
// G string
// S string
// }
// checkHeader := make(map[string]*hashtagValue)
// for _, col := range rows[0] {
// if strings.Contains(col, "Cagatay") {
// fmt.Print("deneme")
// }
// var keySplitOne string
// hs := &hashtagValue{
// B: "",
// N: "",
// G: "",
// S: "",
// }
// key := col
// if strings.Contains(col, "#") {
// keySplit := strings.SplitN(col, " #", 2)
// key = strings.TrimSpace(keySplit[0])
// keySplitOne = strings.TrimSpace(keySplit[0])
// fmt.Print(keySplitOne)
// if existingHS, ok := checkHeader[key]; ok {
// hs = existingHS
// }
// // Burada keySplitOne değerine göre hs struct'ının hangi alanını dolduracağımızı belirliyoruz
// if keySplit[1] == "B" {
// hs.B = keySplit[1]
// } else if keySplit[1] == "N" {
// hs.N = keySplit[1]
// } else if keySplit[1] == "G" {
// hs.G = keySplit[1]
// } else if keySplit[1] == "S" {
// hs.S = keySplit[1]
// }
// }
// checkHeader[key] = hs
// }
var lastItem bool = false
// data := make([]*model.Bordro, 0) // []*Bordro türünde bir dilim oluştur
@@ -141,31 +184,41 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
keySplitOne := strings.TrimSpace(keySplit[0])
tseK := strings.TrimSpace(keySplit[1])
fmt.Print(tseK)
for k, _ := range brd.Ucretler {
for k, d := range brd.Ucretler {
if strings.Contains(k, keySplitOne) { //k=olan
a := d.String()
fmt.Print(a)
if strings.Contains(k, "B") && strings.Contains(tseK, "N") {
emitLog("Şube : aynı anda B ve N Sütunu Girilemez ")
status = true
break
if col != "" && a != "0" {
emitLog(key + " : 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
if col != "" && a != "0" {
emitLog(key + " : aynı anda N ve B Sütunu Girilemez ")
status = true
break
break
}
}
if strings.Contains(k, "G") && strings.Contains(tseK, "S") {
emitLog("Şube : aynı anda G ve S Sütunu Girilemez ")
status = true
if col != "" && a != "0" {
emitLog(key + ": aynı anda G ve S Sütunu Girilemez ")
status = true
break
break
}
}
if strings.Contains(k, "S") && strings.Contains(tseK, "G") {
emitLog("Şube : aynı anda S ve G Sütunu Girilemez ")
status = true
if col != "" && a != "0" {
emitLog(key + ": aynı anda S ve G Sütunu Girilemez ")
status = true
break
break
}
}
}
@@ -191,7 +244,7 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
}
}
if status {
break
continue
}
if i == len(rows)-1 {
lastItem = true