step 13 : add rekap kehadiran homescreen
This commit is contained in:
@@ -59,11 +59,20 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Query struct {
|
Query struct {
|
||||||
QueryCheckDistance func(childComplexity int, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) int
|
QueryCheckDistance func(childComplexity int, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) int
|
||||||
QueryCheckTimeAttendance func(childComplexity int, mStaffID string, mCompanyID string, token string) int
|
QueryCheckTimeAttendance func(childComplexity int, mStaffID string, mCompanyID string, token string) int
|
||||||
SearchStaffByEmail func(childComplexity int, email string) int
|
QueryRekapKehadiranHomeScreen func(childComplexity int, mStaffID string, mCompanyID string, token string) int
|
||||||
StaffGetByStaffID func(childComplexity int, staffID string) int
|
SearchStaffByEmail func(childComplexity int, email string) int
|
||||||
StaffListBySearch func(childComplexity int, search *string, page *int, maxPerPage *int) int
|
StaffGetByStaffID func(childComplexity int, staffID string) int
|
||||||
|
StaffListBySearch func(childComplexity int, search *string, page *int, maxPerPage *int) int
|
||||||
|
}
|
||||||
|
|
||||||
|
RekapKehadiranHomeScreen struct {
|
||||||
|
Kehadiran func(childComplexity int) int
|
||||||
|
Lembur func(childComplexity int) int
|
||||||
|
Message func(childComplexity int) int
|
||||||
|
Status func(childComplexity int) int
|
||||||
|
TidakHadir func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
Staff struct {
|
Staff struct {
|
||||||
@@ -125,6 +134,7 @@ type QueryResolver interface {
|
|||||||
StaffListBySearch(ctx context.Context, search *string, page *int, maxPerPage *int) ([]*model.Staff, error)
|
StaffListBySearch(ctx context.Context, search *string, page *int, maxPerPage *int) ([]*model.Staff, error)
|
||||||
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error)
|
QueryCheckDistance(ctx context.Context, mStaffID string, mCompanyID string, currentLatitude string, currentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error)
|
||||||
QueryCheckTimeAttendance(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.TransAbsensiCheckTimeAttendanceResponse, error)
|
QueryCheckTimeAttendance(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.TransAbsensiCheckTimeAttendanceResponse, error)
|
||||||
|
QueryRekapKehadiranHomeScreen(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.RekapKehadiranHomeScreen, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type executableSchema struct {
|
type executableSchema struct {
|
||||||
@@ -232,6 +242,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Query.QueryCheckTimeAttendance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["token"].(string)), true
|
return e.complexity.Query.QueryCheckTimeAttendance(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["token"].(string)), true
|
||||||
|
|
||||||
|
case "Query.queryRekapKehadiranHomeScreen":
|
||||||
|
if e.complexity.Query.QueryRekapKehadiranHomeScreen == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
args, err := ec.field_Query_queryRekapKehadiranHomeScreen_args(context.TODO(), rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Query.QueryRekapKehadiranHomeScreen(childComplexity, args["M_StaffID"].(string), args["M_CompanyID"].(string), args["token"].(string)), true
|
||||||
|
|
||||||
case "Query.searchStaffByEmail":
|
case "Query.searchStaffByEmail":
|
||||||
if e.complexity.Query.SearchStaffByEmail == nil {
|
if e.complexity.Query.SearchStaffByEmail == nil {
|
||||||
break
|
break
|
||||||
@@ -268,6 +290,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Query.StaffListBySearch(childComplexity, args["search"].(*string), args["page"].(*int), args["maxPerPage"].(*int)), true
|
return e.complexity.Query.StaffListBySearch(childComplexity, args["search"].(*string), args["page"].(*int), args["maxPerPage"].(*int)), true
|
||||||
|
|
||||||
|
case "RekapKehadiranHomeScreen.kehadiran":
|
||||||
|
if e.complexity.RekapKehadiranHomeScreen.Kehadiran == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.RekapKehadiranHomeScreen.Kehadiran(childComplexity), true
|
||||||
|
|
||||||
|
case "RekapKehadiranHomeScreen.lembur":
|
||||||
|
if e.complexity.RekapKehadiranHomeScreen.Lembur == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.RekapKehadiranHomeScreen.Lembur(childComplexity), true
|
||||||
|
|
||||||
|
case "RekapKehadiranHomeScreen.message":
|
||||||
|
if e.complexity.RekapKehadiranHomeScreen.Message == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.RekapKehadiranHomeScreen.Message(childComplexity), true
|
||||||
|
|
||||||
|
case "RekapKehadiranHomeScreen.status":
|
||||||
|
if e.complexity.RekapKehadiranHomeScreen.Status == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.RekapKehadiranHomeScreen.Status(childComplexity), true
|
||||||
|
|
||||||
|
case "RekapKehadiranHomeScreen.tidak_hadir":
|
||||||
|
if e.complexity.RekapKehadiranHomeScreen.TidakHadir == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.RekapKehadiranHomeScreen.TidakHadir(childComplexity), true
|
||||||
|
|
||||||
case "Staff.company_id":
|
case "Staff.company_id":
|
||||||
if e.complexity.Staff.CompanyID == nil {
|
if e.complexity.Staff.CompanyID == nil {
|
||||||
break
|
break
|
||||||
@@ -663,6 +720,15 @@ type TransAbsensiCheckTimeAttendanceResponse {
|
|||||||
is_absen_clock_out: String
|
is_absen_clock_out: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# response home screen rekap kehadiran
|
||||||
|
type RekapKehadiranHomeScreen {
|
||||||
|
status: String
|
||||||
|
message: String
|
||||||
|
kehadiran: String
|
||||||
|
tidak_hadir: String
|
||||||
|
lembur: String
|
||||||
|
}
|
||||||
|
|
||||||
# query
|
# query
|
||||||
extend type Query {
|
extend type Query {
|
||||||
# untuk cek distance dengan fungsi distance_v2 di database
|
# untuk cek distance dengan fungsi distance_v2 di database
|
||||||
@@ -670,6 +736,9 @@ extend type Query {
|
|||||||
|
|
||||||
# untuk check waktu absen masuk dan pulang
|
# untuk check waktu absen masuk dan pulang
|
||||||
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
||||||
|
|
||||||
|
# untuk home screen rekap kehadiran
|
||||||
|
queryRekapKehadiranHomeScreen(M_StaffID:String!, M_CompanyID:String!, token:String!) : RekapKehadiranHomeScreen!
|
||||||
}
|
}
|
||||||
|
|
||||||
# mutation
|
# mutation
|
||||||
@@ -981,6 +1050,39 @@ func (ec *executionContext) field_Query_queryCheckTimeAttendance_args(ctx contex
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Query_queryRekapKehadiranHomeScreen_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
|
var err error
|
||||||
|
args := map[string]interface{}{}
|
||||||
|
var arg0 string
|
||||||
|
if tmp, ok := rawArgs["M_StaffID"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_StaffID"))
|
||||||
|
arg0, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["M_StaffID"] = arg0
|
||||||
|
var arg1 string
|
||||||
|
if tmp, ok := rawArgs["M_CompanyID"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("M_CompanyID"))
|
||||||
|
arg1, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["M_CompanyID"] = arg1
|
||||||
|
var arg2 string
|
||||||
|
if tmp, ok := rawArgs["token"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token"))
|
||||||
|
arg2, err = ec.unmarshalNString2string(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["token"] = arg2
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_searchStaffByEmail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_searchStaffByEmail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
@@ -1833,6 +1935,73 @@ func (ec *executionContext) fieldContext_Query_queryCheckTimeAttendance(ctx cont
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Query_queryRekapKehadiranHomeScreen(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Query_queryRekapKehadiranHomeScreen(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return ec.resolvers.Query().QueryRekapKehadiranHomeScreen(rctx, fc.Args["M_StaffID"].(string), fc.Args["M_CompanyID"].(string), fc.Args["token"].(string))
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*model.RekapKehadiranHomeScreen)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNRekapKehadiranHomeScreen2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐRekapKehadiranHomeScreen(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Query_queryRekapKehadiranHomeScreen(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Query",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: true,
|
||||||
|
IsResolver: true,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "status":
|
||||||
|
return ec.fieldContext_RekapKehadiranHomeScreen_status(ctx, field)
|
||||||
|
case "message":
|
||||||
|
return ec.fieldContext_RekapKehadiranHomeScreen_message(ctx, field)
|
||||||
|
case "kehadiran":
|
||||||
|
return ec.fieldContext_RekapKehadiranHomeScreen_kehadiran(ctx, field)
|
||||||
|
case "tidak_hadir":
|
||||||
|
return ec.fieldContext_RekapKehadiranHomeScreen_tidak_hadir(ctx, field)
|
||||||
|
case "lembur":
|
||||||
|
return ec.fieldContext_RekapKehadiranHomeScreen_lembur(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type RekapKehadiranHomeScreen", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = ec.Recover(ctx, r)
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
if fc.Args, err = ec.field_Query_queryRekapKehadiranHomeScreen_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return fc, err
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Query___type(ctx, field)
|
fc, err := ec.fieldContext_Query___type(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1962,6 +2131,211 @@ func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, fie
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen_status(ctx context.Context, field graphql.CollectedField, obj *model.RekapKehadiranHomeScreen) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_RekapKehadiranHomeScreen_status(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Status, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_RekapKehadiranHomeScreen_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "RekapKehadiranHomeScreen",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen_message(ctx context.Context, field graphql.CollectedField, obj *model.RekapKehadiranHomeScreen) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_RekapKehadiranHomeScreen_message(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Message, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_RekapKehadiranHomeScreen_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "RekapKehadiranHomeScreen",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen_kehadiran(ctx context.Context, field graphql.CollectedField, obj *model.RekapKehadiranHomeScreen) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_RekapKehadiranHomeScreen_kehadiran(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Kehadiran, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_RekapKehadiranHomeScreen_kehadiran(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "RekapKehadiranHomeScreen",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen_tidak_hadir(ctx context.Context, field graphql.CollectedField, obj *model.RekapKehadiranHomeScreen) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_RekapKehadiranHomeScreen_tidak_hadir(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.TidakHadir, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_RekapKehadiranHomeScreen_tidak_hadir(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "RekapKehadiranHomeScreen",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen_lembur(ctx context.Context, field graphql.CollectedField, obj *model.RekapKehadiranHomeScreen) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_RekapKehadiranHomeScreen_lembur(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Lembur, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_RekapKehadiranHomeScreen_lembur(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "RekapKehadiranHomeScreen",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Staff_staff_id(ctx context.Context, field graphql.CollectedField, obj *model.Staff) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Staff_staff_id(ctx context.Context, field graphql.CollectedField, obj *model.Staff) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Staff_staff_id(ctx, field)
|
fc, err := ec.fieldContext_Staff_staff_id(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -5268,6 +5642,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
|||||||
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
||||||
|
case "queryRekapKehadiranHomeScreen":
|
||||||
|
field := field
|
||||||
|
|
||||||
|
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
res = ec._Query_queryRekapKehadiranHomeScreen(ctx, field)
|
||||||
|
if res == graphql.Null {
|
||||||
|
atomic.AddUint32(&fs.Invalids, 1)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
rrm := func(ctx context.Context) graphql.Marshaler {
|
||||||
|
return ec.OperationContext.RootResolverMiddleware(ctx,
|
||||||
|
func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||||
|
}
|
||||||
|
|
||||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) })
|
||||||
case "__type":
|
case "__type":
|
||||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
@@ -5300,6 +5696,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rekapKehadiranHomeScreenImplementors = []string{"RekapKehadiranHomeScreen"}
|
||||||
|
|
||||||
|
func (ec *executionContext) _RekapKehadiranHomeScreen(ctx context.Context, sel ast.SelectionSet, obj *model.RekapKehadiranHomeScreen) graphql.Marshaler {
|
||||||
|
fields := graphql.CollectFields(ec.OperationContext, sel, rekapKehadiranHomeScreenImplementors)
|
||||||
|
|
||||||
|
out := graphql.NewFieldSet(fields)
|
||||||
|
deferred := make(map[string]*graphql.FieldSet)
|
||||||
|
for i, field := range fields {
|
||||||
|
switch field.Name {
|
||||||
|
case "__typename":
|
||||||
|
out.Values[i] = graphql.MarshalString("RekapKehadiranHomeScreen")
|
||||||
|
case "status":
|
||||||
|
out.Values[i] = ec._RekapKehadiranHomeScreen_status(ctx, field, obj)
|
||||||
|
case "message":
|
||||||
|
out.Values[i] = ec._RekapKehadiranHomeScreen_message(ctx, field, obj)
|
||||||
|
case "kehadiran":
|
||||||
|
out.Values[i] = ec._RekapKehadiranHomeScreen_kehadiran(ctx, field, obj)
|
||||||
|
case "tidak_hadir":
|
||||||
|
out.Values[i] = ec._RekapKehadiranHomeScreen_tidak_hadir(ctx, field, obj)
|
||||||
|
case "lembur":
|
||||||
|
out.Values[i] = ec._RekapKehadiranHomeScreen_lembur(ctx, field, obj)
|
||||||
|
default:
|
||||||
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.Dispatch(ctx)
|
||||||
|
if out.Invalids > 0 {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
|
||||||
|
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
|
||||||
|
|
||||||
|
for label, dfs := range deferred {
|
||||||
|
ec.processDeferredGroup(graphql.DeferredGroup{
|
||||||
|
Label: label,
|
||||||
|
Path: graphql.GetPath(ctx),
|
||||||
|
FieldSet: dfs,
|
||||||
|
Context: ctx,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
var staffImplementors = []string{"Staff"}
|
var staffImplementors = []string{"Staff"}
|
||||||
|
|
||||||
func (ec *executionContext) _Staff(ctx context.Context, sel ast.SelectionSet, obj *model.Staff) graphql.Marshaler {
|
func (ec *executionContext) _Staff(ctx context.Context, sel ast.SelectionSet, obj *model.Staff) graphql.Marshaler {
|
||||||
@@ -5920,6 +6360,20 @@ func (ec *executionContext) marshalNLogoutResponse2ᚖcomᚗsismedikaᚗcomᚗab
|
|||||||
return ec._LogoutResponse(ctx, sel, v)
|
return ec._LogoutResponse(ctx, sel, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNRekapKehadiranHomeScreen2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐRekapKehadiranHomeScreen(ctx context.Context, sel ast.SelectionSet, v model.RekapKehadiranHomeScreen) graphql.Marshaler {
|
||||||
|
return ec._RekapKehadiranHomeScreen(ctx, sel, &v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNRekapKehadiranHomeScreen2ᚖcomᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐRekapKehadiranHomeScreen(ctx context.Context, sel ast.SelectionSet, v *model.RekapKehadiranHomeScreen) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
|
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return ec._RekapKehadiranHomeScreen(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNStaff2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐStaff(ctx context.Context, sel ast.SelectionSet, v model.Staff) graphql.Marshaler {
|
func (ec *executionContext) marshalNStaff2comᚗsismedikaᚗcomᚗabsensiᚋgraphᚋmodelᚐStaff(ctx context.Context, sel ast.SelectionSet, v model.Staff) graphql.Marshaler {
|
||||||
return ec._Staff(ctx, sel, &v)
|
return ec._Staff(ctx, sel, &v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ type TransAbsensiCheckTimeAttendanceResponse {
|
|||||||
is_absen_clock_out: String
|
is_absen_clock_out: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# response home screen rekap kehadiran
|
||||||
|
type RekapKehadiranHomeScreen {
|
||||||
|
status: String
|
||||||
|
message: String
|
||||||
|
kehadiran: String
|
||||||
|
tidak_hadir: String
|
||||||
|
lembur: String
|
||||||
|
}
|
||||||
|
|
||||||
# query
|
# query
|
||||||
extend type Query {
|
extend type Query {
|
||||||
# untuk cek distance dengan fungsi distance_v2 di database
|
# untuk cek distance dengan fungsi distance_v2 di database
|
||||||
@@ -31,6 +40,9 @@ extend type Query {
|
|||||||
|
|
||||||
# untuk check waktu absen masuk dan pulang
|
# untuk check waktu absen masuk dan pulang
|
||||||
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
queryCheckTimeAttendance(M_StaffID:String!, M_CompanyID:String!, token:String!) : TransAbsensiCheckTimeAttendanceResponse!
|
||||||
|
|
||||||
|
# untuk home screen rekap kehadiran
|
||||||
|
queryRekapKehadiranHomeScreen(M_StaffID:String!, M_CompanyID:String!, token:String!) : RekapKehadiranHomeScreen!
|
||||||
}
|
}
|
||||||
|
|
||||||
# mutation
|
# mutation
|
||||||
|
|||||||
@@ -13,6 +13,14 @@ type Mutation struct {
|
|||||||
type Query struct {
|
type Query struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RekapKehadiranHomeScreen struct {
|
||||||
|
Status *string `json:"status,omitempty"`
|
||||||
|
Message *string `json:"message,omitempty"`
|
||||||
|
Kehadiran *string `json:"kehadiran,omitempty"`
|
||||||
|
TidakHadir *string `json:"tidak_hadir,omitempty"`
|
||||||
|
Lembur *string `json:"lembur,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type Staff struct {
|
type Staff struct {
|
||||||
StaffID string `json:"staff_id"`
|
StaffID string `json:"staff_id"`
|
||||||
Nip string `json:"nip"`
|
Nip string `json:"nip"`
|
||||||
|
|||||||
@@ -38,3 +38,10 @@ func (r *queryResolver) QueryCheckTimeAttendance(ctx context.Context, mStaffID s
|
|||||||
var transabsensiinternal transabsensiinternal.TransAbsensiCheckTimeAttendanceResponse
|
var transabsensiinternal transabsensiinternal.TransAbsensiCheckTimeAttendanceResponse
|
||||||
return transabsensiinternal.CheckTimeAttendance(mStaffID, mCompanyID, token)
|
return transabsensiinternal.CheckTimeAttendance(mStaffID, mCompanyID, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryRekapKehadiranHomeScreen is the resolver for the queryRekapKehadiranHomeScreen field.
|
||||||
|
func (r *queryResolver) QueryRekapKehadiranHomeScreen(ctx context.Context, mStaffID string, mCompanyID string, token string) (*model.RekapKehadiranHomeScreen, error) {
|
||||||
|
// panic(fmt.Errorf("not implemented: QueryRekapKehadiranHomeScreen - queryRekapKehadiranHomeScreen"))
|
||||||
|
var transabsensiinternal transabsensiinternal.RekapKehadiranHomeScreen
|
||||||
|
return transabsensiinternal.RekapKehadiranHomeScreen(mStaffID, mCompanyID, token)
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ type TransAbsensiResponse model.TransAbsensiResponse
|
|||||||
|
|
||||||
type TransAbsensiCheckTimeAttendanceResponse model.TransAbsensiCheckTimeAttendanceResponse
|
type TransAbsensiCheckTimeAttendanceResponse model.TransAbsensiCheckTimeAttendanceResponse
|
||||||
|
|
||||||
|
type RekapKehadiranHomeScreen model.RekapKehadiranHomeScreen
|
||||||
|
|
||||||
// fungsi untuk Check Distance antara kantor dengan current user location
|
// fungsi untuk Check Distance antara kantor dengan current user location
|
||||||
func (transabsensi *TransAbsensiCheckDistanceResponse) CheckDistance(M_StaffID string, M_CompanyID string, CurrentLatitude string, CurrentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error) {
|
func (transabsensi *TransAbsensiCheckDistanceResponse) CheckDistance(M_StaffID string, M_CompanyID string, CurrentLatitude string, CurrentLongitude string) (*model.TransAbsensiCheckDistanceResponse, error) {
|
||||||
// inisialisasi
|
// inisialisasi
|
||||||
@@ -672,3 +674,215 @@ func (transabsensi *TransAbsensiCheckTimeAttendanceResponse) CheckTimeAttendance
|
|||||||
|
|
||||||
return &ret, err
|
return &ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fungsi untuk rekap kehadiran home screen
|
||||||
|
func (transabsensi *RekapKehadiranHomeScreen) RekapKehadiranHomeScreen(M_StaffID string, M_CompanyID string, token string) (*model.RekapKehadiranHomeScreen, error) {
|
||||||
|
|
||||||
|
// inisialisasi
|
||||||
|
var err error
|
||||||
|
var ret model.RekapKehadiranHomeScreen
|
||||||
|
|
||||||
|
var jumlah_saturday int = 0
|
||||||
|
var jumlah_sunday int = 0
|
||||||
|
var jumlah_hari_bulan_ini int = 0
|
||||||
|
|
||||||
|
var jumlah_hari_sampai_hari_ini_point_a int = 0
|
||||||
|
var jumlah_hari_libur_sampai_hari_ini_point_b int = 0
|
||||||
|
var jumlah_absen_sampai_hari_ini_point_c int = 0
|
||||||
|
var total_ketidakhadiran int = 0
|
||||||
|
var total_lembur_sampai_hari_ini int = 0
|
||||||
|
|
||||||
|
// clear memory address
|
||||||
|
ret.Kehadiran = new(string)
|
||||||
|
ret.Lembur = new(string)
|
||||||
|
ret.TidakHadir = new(string)
|
||||||
|
ret.Status = new(string)
|
||||||
|
ret.Message = new(string)
|
||||||
|
|
||||||
|
// set value
|
||||||
|
*ret.TidakHadir = "0"
|
||||||
|
*ret.Kehadiran = "0"
|
||||||
|
*ret.Lembur = "0"
|
||||||
|
|
||||||
|
// query rekap lembur
|
||||||
|
qLembur := `SELECT COUNT(T_TransactionLemburID) as total_lembur_sampai_hari_ini
|
||||||
|
FROM t_transaction_lembur
|
||||||
|
WHERE
|
||||||
|
T_TransactionLemburIsActive = 'Y'
|
||||||
|
AND T_TransactionLemburM_StaffID = ?
|
||||||
|
AND T_TransactionLemburM_CompanyID = ?
|
||||||
|
AND T_TransactionLemburM_AbsensiTypeID = 5
|
||||||
|
AND MONTH(T_TransactionTglLembur) = MONTH(CURDATE())`
|
||||||
|
|
||||||
|
rowQLembur := db.Handle.QueryRow(
|
||||||
|
qLembur,
|
||||||
|
M_StaffID,
|
||||||
|
M_CompanyID,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count lembur: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qLembur)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qLembur)
|
||||||
|
err = rowQLembur.Scan(
|
||||||
|
&total_lembur_sampai_hari_ini,
|
||||||
|
)
|
||||||
|
|
||||||
|
// query point A : jumlah hari sampai hari ini ( dalam bulan ini ) selain sabtu dan minggu
|
||||||
|
qCountSaturday := `WITH RECURSIVE offdays as(
|
||||||
|
SELECT
|
||||||
|
LAST_DAY(CURDATE()-INTERVAL 1 MONTH) + INTERVAL 1 DAY AS Date,
|
||||||
|
DAYNAME(LAST_DAY(CURDATE()-INTERVAL 1 MONTH) + INTERVAL 1 DAY) AS DayName
|
||||||
|
UNION ALL
|
||||||
|
SELECT Date + INTERVAL 1 DAY, DAYNAME(Date + INTERVAL 1 DAY)
|
||||||
|
FROM offdays WHERE DATE < LAST_DAY(CURDATE())
|
||||||
|
) SELECT count(*) as countSaturday FROM offdays where DAYNAME(DATE) = 'Saturday'`
|
||||||
|
|
||||||
|
rowQCountSaturday := db.Handle.QueryRow(
|
||||||
|
qCountSaturday,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count jumlah saturday : %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qCountSaturday)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qCountSaturday)
|
||||||
|
err = rowQCountSaturday.Scan(
|
||||||
|
&jumlah_saturday,
|
||||||
|
)
|
||||||
|
|
||||||
|
qCountSunday := `WITH RECURSIVE offdays as(
|
||||||
|
SELECT
|
||||||
|
LAST_DAY(CURDATE()-INTERVAL 1 MONTH) + INTERVAL 1 DAY AS Date,
|
||||||
|
DAYNAME(LAST_DAY(CURDATE()-INTERVAL 1 MONTH) + INTERVAL 1 DAY) AS DayName
|
||||||
|
UNION ALL
|
||||||
|
SELECT Date + INTERVAL 1 DAY, DAYNAME(Date + INTERVAL 1 DAY)
|
||||||
|
FROM offdays WHERE DATE < LAST_DAY(CURDATE())
|
||||||
|
) SELECT count(*) as countSaturday FROM offdays where DAYNAME(DATE) = 'Sunday'`
|
||||||
|
|
||||||
|
rowQCountSunday := db.Handle.QueryRow(
|
||||||
|
qCountSunday,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count jumlah saturday : %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qCountSunday)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qCountSunday)
|
||||||
|
err = rowQCountSunday.Scan(
|
||||||
|
&jumlah_sunday,
|
||||||
|
)
|
||||||
|
|
||||||
|
qJumlahHariBulanIni := `select timestampdiff(day,
|
||||||
|
concat(year(now()),'-',month(now()),'-01'),
|
||||||
|
date_add( concat(year(now()),'-',month(now()),'-01'), interval 1 month)) as jumlah_hari_bulan_ini`
|
||||||
|
|
||||||
|
rowQJumlahHariBulanIni := db.Handle.QueryRow(
|
||||||
|
qJumlahHariBulanIni,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count jumlah_hari_bulan_ini: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qJumlahHariBulanIni)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qJumlahHariBulanIni)
|
||||||
|
err = rowQJumlahHariBulanIni.Scan(
|
||||||
|
&jumlah_hari_bulan_ini,
|
||||||
|
)
|
||||||
|
|
||||||
|
// hitung point A
|
||||||
|
jumlah_hari_sampai_hari_ini_point_a = jumlah_hari_bulan_ini - jumlah_sunday - jumlah_saturday
|
||||||
|
|
||||||
|
// query point B : jumlah hari libur selain sabtu dan minggu sampai hari ini
|
||||||
|
qPointB := `SELECT COUNT(M_LiburID) as jumlah_hari_libur_sampai_hari_ini_point_b
|
||||||
|
FROM m_libur
|
||||||
|
WHERE
|
||||||
|
M_LiburIsActive = 'Y'
|
||||||
|
AND M_LiburDate <= CURDATE()
|
||||||
|
AND DAYOFWEEK(CURDATE()) BETWEEN 2 AND 6
|
||||||
|
AND MONTH(M_LiburDate) = MONTH(CURDATE())`
|
||||||
|
|
||||||
|
rowQPointB := db.Handle.QueryRow(
|
||||||
|
qPointB,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count jumlah_hari_libur_sampai_hari_ini_point_b: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qPointB)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qPointB)
|
||||||
|
err = rowQPointB.Scan(
|
||||||
|
&jumlah_hari_libur_sampai_hari_ini_point_b,
|
||||||
|
)
|
||||||
|
|
||||||
|
// query point C : jumlah absen sampai hari ini ( bisa di lihat dari clock in )
|
||||||
|
qPointC := `SELECT COUNT(T_TransactionID) as jumlah_absen_sampai_hari_ini_point_c
|
||||||
|
FROM t_transaction
|
||||||
|
WHERE
|
||||||
|
T_TransactionIsActive = 'Y'
|
||||||
|
AND T_TransactionM_StaffID = ?
|
||||||
|
AND T_TransactionM_CompanyID = ?
|
||||||
|
AND (
|
||||||
|
T_TransactionDate >= DATE_FORMAT(CURDATE(), '%Y-%m-01')
|
||||||
|
OR T_TransactionDate = CURDATE()
|
||||||
|
)
|
||||||
|
AND (
|
||||||
|
T_TransactionM_AbsensiTypeID = 1
|
||||||
|
AND (T_TransactionClockAbsensi != '00:00:00' OR T_TransactionClockAbsensi IS NOT NULL)
|
||||||
|
)`
|
||||||
|
|
||||||
|
rowQPointC := db.Handle.QueryRow(
|
||||||
|
qPointC,
|
||||||
|
M_StaffID,
|
||||||
|
M_CompanyID,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error select count jumlah_absen_sampai_hari_ini_point_c: %v", err)
|
||||||
|
log.Printf("Executing query: %s\n", qPointC)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.LogSQL(qPointC)
|
||||||
|
err = rowQPointC.Scan(
|
||||||
|
&jumlah_absen_sampai_hari_ini_point_c,
|
||||||
|
)
|
||||||
|
|
||||||
|
total_ketidakhadiran = jumlah_hari_sampai_hari_ini_point_a - jumlah_hari_libur_sampai_hari_ini_point_b - jumlah_absen_sampai_hari_ini_point_c
|
||||||
|
|
||||||
|
log.Printf("Executing jumlah_saturday: %s\n", strconv.Itoa(jumlah_saturday))
|
||||||
|
log.Printf("Executing jumlah_sunday: %s\n", strconv.Itoa(jumlah_sunday))
|
||||||
|
log.Printf("Executing jumlah_hari_bulan_ini: %s\n", strconv.Itoa(jumlah_hari_bulan_ini))
|
||||||
|
|
||||||
|
log.Printf("Executing jumlah_hari_sampai_hari_ini_point_a: %s\n", strconv.Itoa(jumlah_hari_sampai_hari_ini_point_a))
|
||||||
|
log.Printf("Executing jumlah_hari_libur_sampai_hari_ini_point_b: %s\n", strconv.Itoa(jumlah_hari_libur_sampai_hari_ini_point_b))
|
||||||
|
log.Printf("Executing jumlah_absen_sampai_hari_ini_point_c: %s\n", strconv.Itoa(jumlah_absen_sampai_hari_ini_point_c))
|
||||||
|
|
||||||
|
if total_ketidakhadiran != 0 {
|
||||||
|
*ret.TidakHadir = strconv.Itoa(total_ketidakhadiran)
|
||||||
|
}
|
||||||
|
|
||||||
|
if jumlah_absen_sampai_hari_ini_point_c != 0 {
|
||||||
|
*ret.Kehadiran = strconv.Itoa(jumlah_absen_sampai_hari_ini_point_c)
|
||||||
|
}
|
||||||
|
|
||||||
|
if total_lembur_sampai_hari_ini != 0 {
|
||||||
|
*ret.Lembur = strconv.Itoa(total_lembur_sampai_hari_ini)
|
||||||
|
}
|
||||||
|
|
||||||
|
*ret.Status = "OK"
|
||||||
|
*ret.Message = "Rekap Kehadiran Muncul"
|
||||||
|
|
||||||
|
return &ret, err
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user