Func _cmdActionFIMI()
Local $tmpNotice,$Result[6],$tmpRecNo=1,$Addr="https://.....com.vn",$Open
Local $Update,$CardNo,$aArray,$ListNo=0,$FListFinish=0,$oIE,$tmpCondition,$GetID=False
;$oIE=_LoginFIMI($FUserName,_Decode($FPassword),$Addr)
$oIE=1
If $oIE=0 Then
Return 0
EndIf
ToolTip("OPENNING "&$FXLSPath)
$oExcel = _Excel_Open($FXLSPath,1)
If $oExcel=0 Then
Switch @error
Case 1
MsgBox(0, "Óe !!!", "Cannot open !")
Case 2
MsgBox(0, "Óe !!!", "Not find file !")
EndSwitch
ToolTip("")
Return 0
EndIf
_Excel_BookOpen($oExcel, "nhaplieu")
;$Open=Not (_ExcelReadCell($oExcel,13,5)="Đóng thẻ")
;If $Open Then
; MsgBox(0,"o",$Open)
;EndIf
;Exit
_Excel_BookOpen($oExcel, "ketqua")
$aArray=_Excel_RangeRead($oExcel)
For $i=1 to $aArray[0][0]-1
If $aArray[$i+1][2]<>"" Then $ListNo+=1
Next
For $i=1 to $ListNo
If $aArray[$i+1][4]<>"" Then $FListFinish+=1
Next
Do
$CardNo=$aArray[$tmpRecNo+1][2]
$Update=$aArray[$tmpRecNo+1][4]
If $Update="" Then
If GUICtrlRead($chkID)=$GUI_CHECKED Then $GetID=True
$Result=_Input1CardNo($FListFinish+1,$ListNo,$CardNo,$Addr,$oIE,$GetID,$Open)
$FListFinish+=1
$tmpCondition='DPType="'&StringMid($Result[2],5,3)&'" AND Acct="'&StringRight($Result[2],6)&'"'
$tmpNotice=StringReplace(_GetValue("Notice","CIF",$tmpCondition),4,$Result[0])
_SQLite_Exec(-1, 'UPDATE CIF SET Notice="'&$tmpNotice&'" WHERE '&$tmpCondition)
_SQLite_Exec(-1, 'UPDATE CIF SET CardNo="'&$CardNo&'" WHERE '&$tmpCondition)
_Excel_RangeWrite($oExcel,$Result[1],$tmpRecNo+1,3)
_Excel_RangeWrite($oExcel,$Result[2],$tmpRecNo+1,4)
_Excel_RangeWrite($oExcel,$Result[3],$tmpRecNo+1,5)
_Excel_RangeWrite($oExcel,$Result[4],$tmpRecNo+1,6)
_Excel_RangeWrite($oExcel,$Result[5],$tmpRecNo+1,7)
EndIf
$tmpRecNo+=1
Until $tmpRecNo>$ListNo
ToolTip("")
MsgBox(0,"OK!","I've finished!!!")
EndFunc