Function at 0x475647
Capabilities:
Reference sql statements
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x5f4
mov eax, dword [0x5345d0]
xor eax, esp
mov dword [esp + 0x5f0], eax
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 0x10]
push ebx
mov ebx, dword [ebp + 0xc]
push esi
xor esi, esi
cmp eax, esi
push edi
mov dword [esp + 0x3c], eax
mov dword [esp + 0x38], ecx
mov dword [esp + 0x18], esi
je 0x475e04
cmp ebx, esi
je 0x475e04
mov eax, dword [ebx + 0x14]
call fcn.004517d2
xor eax, eax
mov word [esp + 0x58], si
lea edi, [esp + 0x5a]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
push 0x3ff
stosw word es:[edi], ax
lea eax, [esp + 0x1fd]
push esi
push eax
mov byte [esp + 0x204], 0
call fcn.004b53e0
add esp, 0xc
push 0x7f
lea eax, [esp + 0x7d]
push esi
push eax
mov byte [esp + 0x84], 0
call fcn.004b53e0
add esp, 0xc
push 0xff
lea eax, [esp + 0xfd]
push esi
push eax
mov byte [esp + 0x104], 0
call fcn.004b53e0
add esp, 0xc
mov dword [esp + 0x1c], esi
call fcn.0047756c
call fcn.00477593
cmp dword [ebx + 0x2f94], esi
jne 0x475718
mov eax, dword [ebx + 0x14]
call fcn.00481733
mov dword [ebx + 0x14], esi
push esi
call fcn.00476864
test eax, eax
mov eax, dword [ebx + 0x14]
pop ecx
je 0x475744
call fcn.004517d2
test eax, eax
je 0x475e04
push dword [ebx + 0x14]
call fcn.00451078
pop ecx
mov dword [ebx + 0x14], esi
jmp 0x475e04
call fcn.004517d2
test eax, eax
jne 0x475764
push esi
call fcn.004521ee
mov dword [ebx + 0x14], eax
xor eax, eax
inc eax
pop ecx
mov dword [ebx + 0x2f94], eax
mov dword [esp + 0x1c], eax
mov ecx, dword [ebx + 0x14]
cmp ecx, esi
jne 0x47577b
push str.:5:Need_to_handle_TAMS_II_SA7_login_failure_
call fcn.004178df
pop ecx
jmp 0x475e04
call fcn.004a4f0b
push 0xc02
lea eax, [esp + 0x5c]
push str..ServerPAULA.c
push eax
call fcn.004a57c9
push ecx
lea esi, [esp + 0x68]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a3bac
mov dword [esp + 0x20], eax
mov byte [esp + 0x23], 1
mov eax, dword [esp + 0x20]
mov dword [esp + 0x1c], eax
shr eax, 0x10
add esp, 0x10
inc al
cmp al, 0xc
mov byte [esp + 0xe], al
jbe 0x4757cf
inc word [esp + 0xc]
mov byte [esp + 0xe], 1
mov esi, str.SALES_YEAR_MONTH_ACCOUNTING_DAY_GROSS_CASH_SALES_GROSS_CHARGE_SALES_NET_SALES_RETURNS_RETURNS_COST_MISCELLANEOUS_ADJUSTMENTS_INVOICE_COUNT_VOID_AMOUNT_VOID_COUNT_RECEIVED_ON_ACCOUNT_ROA_DISCOUNT_TAKEN_JOURNAL_ENTRIES_SALES_COST_FREIGHT_CHARGES
push 0x2c
mov edx, esi
call fcn.0047c66e
pop ecx
mov ecx, dword [ebx + 0x14]
inc eax
mov dword [esp + 0x40], eax
call fcn.004524cd
and dword [esp + 0x20], 0
cmp dword [0x53579c], 0
mov dword [esp + 0x14], eax
je 0x47583b
push dword [esp + 0x14]
movzx ecx, byte [esp + 0x13]
mov eax, dword [0x53579c]
push ecx
movzx ecx, byte [esp + 0x16]
inc dword [0x53579c]
push ecx
movzx ecx, word [esp + 0x18]
push ecx
movzx ecx, byte [esp + 0x22]
push 1
push ecx
movzx ecx, word [esp + 0x28]
push ecx
push esi
push eax
push str.SA7_DBG__d:_SET_ROWCOUNT_1_SELECT__s_FROM_STORE_DAILY_SALES_WHERE__SALES_YEAR_MONTH_04d__02d__02d_OR_SALES_YEAR_MONTH_04d__02d__02d__AND_LOC_d_ORDER_BY_SALES_YEAR_MONTH_DESC__ACCOUNTING_DAY_DESC
call fcn.00417db7
add esp, 0x28
push dword [esp + 0x14]
movzx edi, byte [esp + 0x13]
movzx eax, byte [esp + 0x12]
movzx ecx, word [esp + 0x10]
movzx edx, word [esp + 0x14]
push edi
push eax
movzx eax, byte [esp + 0x1e]
push ecx
push 1
push eax
push edx
push esi
push str.SET_ROWCOUNT_1_SELECT__s_FROM_STORE_DAILY_SALES_WHERE__SALES_YEAR_MONTH_04d__02d__02d_OR_SALES_YEAR_MONTH_04d__02d__02d__AND_LOC_d_ORDER_BY_SALES_YEAR_MONTH_DESC__ACCOUNTING_DAY_DESC
push dword [ebx + 0x14]
mov dword [esp + 0x6c], ecx
mov dword [esp + 0x5c], edx
call fcn.0045145b
add esp, 0x28
test eax, eax
je 0x475c2f
push dword [esp + 0x40]
lea eax, [esp + 0x1fc]
push 9
push 0x3ff
push eax
push dword [ebx + 0x14]
call fcn.0045155b
add esp, 0x14
test eax, eax
mov esi, ebx
je 0x4758dc
lea eax, [esp + 0x1f8]
call fcn.004754be
test eax, eax
mov dword [esp + 0xc], eax
jne 0x4758e7
lea eax, [esp + 0x1f8]
push eax
push str.:5:RefreshSales___EAP:_Sales_line___s__is_invalid.
lea eax, [esp + 0x100]
push 0x100
push eax
call fcn.0047da40
add esp, 0x10
jmp 0x4758e7
xor eax, eax
call fcn.004754be
mov dword [esp + 0xc], eax
cmp dword [0x53579c], 0
je 0x475911
mov eax, dword [0x53579c]
inc dword [0x53579c]
lea ecx, [esp + 0x1f8]
push ecx
push eax
push str.SA7_DBG__d:__s
call fcn.00417db7
add esp, 0xc
cmp dword [esp + 0xc], 0
jle 0x475b08
mov edi, str.EOD_STARTED_DATE_NEW_DAY_STARTED_DATE_SALES_YEAR_MONTH_ACCT_DAY_STARTED_BY_IP_ADDRESS_STARTED_BY_EMPLOYEE_ID
push 0x2c
mov edx, edi
call fcn.0047c66e
mov esi, eax
inc esi
cmp dword [0x53579c], 0
pop ecx
je 0x475955
push dword [esp + 0x14]
mov eax, dword [0x53579c]
inc dword [0x53579c]
push edi
push eax
push str.SA7_DBG__d:_SET_ROWCOUNT_1_SELECT__s_FROM_END_OF_DAY_MONITOR_WHERE_LOC_d_AND_EOD_STARTED_DATE_SELECT_MAX_EOD_STARTED_DATE__FROM_END_OF_DAY_MONITOR_
call fcn.00417db7
add esp, 0x10
push dword [esp + 0x14]
push edi
push str.SET_ROWCOUNT_1_SELECT__s_FROM_END_OF_DAY_MONITOR_WHERE_LOC_d_AND_EOD_STARTED_DATE_SELECT_MAX_EOD_STARTED_DATE__FROM_END_OF_DAY_MONITOR_
push dword [ebx + 0x14]
call fcn.0045145b
add esp, 0x10
test eax, eax
je 0x475c0a
and word [esp + 0x24], 0
and word [esp + 0x48], 0
xor eax, eax
lea edi, [esp + 0x26]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
and dword [esp + 0x14], 0
stosw word es:[edi], ax
xor eax, eax
lea edi, [esp + 0x4a]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
push esi
push 9
stosw word es:[edi], ax
push 0x3ff
lea eax, [esp + 0x204]
push eax
push dword [ebx + 0x14]
call fcn.0045155b
add esp, 0x14
test eax, eax
je 0x475a80
and dword [esp + 0x10], 0
lea eax, [esp + 0x1f8]
push eax
mov ecx, 0x80
lea eax, [esp + 0x7c]
call fcn.0047c3fc
cmp dword [0x53579c], 0
pop ecx
je 0x475a02
mov eax, dword [0x53579c]
inc dword [0x53579c]
lea ecx, [esp + 0x1f8]
push ecx
push eax
push str.SA7_DBG__d:__s
call fcn.00417db7
add esp, 0xc
lea eax, [esp + 0x10]
lea ecx, [esp + 0x1f8]
call fcn.0047dd44
push eax
lea eax, [esp + 0x6c]
push eax
call fcn.004a45d5
mov esi, eax
lea edi, [esp + 0x2c]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
lea eax, [esp + 0x18]
xor ecx, ecx
movsd dword es:[edi], dword [esi]
call fcn.0047dd44
push eax
lea eax, [esp + 0x74]
push eax
call fcn.004a45d5
mov esi, eax
lea edi, [esp + 0x58]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
lea eax, [esp + 0x20]
xor ecx, ecx
movsd dword es:[edi], dword [esi]
call fcn.0047dd44
lea eax, [esp + 0x20]
xor ecx, ecx
call fcn.0047dd44
push eax
call fcn.0043e85e
mov dword [esp + 0x28], eax
add esp, 0x14
lea eax, [esp + 0x10]
xor ecx, ecx
call fcn.0047dd44
lea eax, [esp + 0x10]
xor ecx, ecx
call fcn.0047dd44
push 0
sub esp, 0x10
lea esi, [esp + 0x38]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a3c4c
add esp, 0x14
test eax, eax
jne 0x475b45
push eax
sub esp, 0x10
lea esi, [esp + 0x5c]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a3c4c
add esp, 0x14
test eax, eax
jne 0x475b45
lea eax, [esp + 0x78]
push eax
sub esp, 0x10
lea esi, [esp + 0x5c]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a4994
add esp, 0x10
push eax
sub esp, 0x10
lea esi, [esp + 0x3c]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a4994
add esp, 0x10
push eax
push str.:7:RefreshSales___EAP:_Sales_CANNOT_be_posted:_stEODTime___s__stNewDayTime___s:__s
lea eax, [esp + 0x108]
push 0x100
push eax
call fcn.0047da40
add esp, 0x18
cmp dword [esp + 0x1c], 0
jne 0x475dea
push dword [ebx + 0x14]
call fcn.00451078
and dword [ebx + 0x14], 0
pop ecx
lea eax, [esp + 0x78]
push eax
push str.:5:RefreshSales___EOP:_The_recycled_connection_failed._Trying_again_with_new_connection...___s
call fcn.004178df
push dword [esp + 0x40]
push ebx
push dword [esp + 0x4c]
call fcn.00475647
add esp, 0x14
jmp 0x475e06
mov eax, dword [esp + 0xc]
push 0xc7b
mov dword [esp + 0x24], eax
lea eax, [ebx + 0x4c]
push str..ServerPAULA.c
push eax
call fcn.004a57c9
movzx eax, word [esp + 0x34]
lea edi, [ebx + 0x5c]
lea esi, [esp + 0x30]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
shl eax, 4
lea edi, [eax + ebx + 0x2f9c]
lea esi, [esp + 0x30]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
push ecx
lea esi, [esp + 0x58]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a3d6f
add esp, 0x10
test eax, eax
jne 0x475c00
sub esp, 0x10
mov edi, esp
lea esi, [esp + 0x34]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
sub esp, 0x10
lea esi, [esp + 0x68]
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a3f09
add esp, 0x20
test eax, eax
jne 0x475c00
and dword [esp + 0x18], eax
mov eax, dword [esp + 0x14]
cmp eax, dword [esp + 0xc]
jg 0x475be1
cmp eax, 1
jne 0x475c69
cmp dword [esp + 0xc], 0x14
jle 0x475c69
push str.Yesterday_sales_catch_test.
lea eax, [esp + 0xfc]
push 0x100
push eax
call fcn.0047da40
add esp, 0xc
jmp 0x475b08
mov dword [esp + 0x18], 1
jmp 0x475c69
lea eax, [esp + 0x78]
push eax
push dword [esp + 0x18]
lea eax, [esp + 0x100]
push str.:7:RefreshSales___EAP:_ExecuteODBCFormat_LOC_d__FAILED:_EOD_cannot_be_determined:__s
push 0x100
push eax
call fcn.0047da40
add esp, 0x14
jmp 0x475c69
lea eax, [esp + 0x78]
push eax
push dword [esp + 0x18]
movzx eax, byte [esp + 0x16]
push edi
push eax
push dword [esp + 0x54]
movzx eax, byte [esp + 0x26]
push 1
push eax
push dword [esp + 0x50]
lea eax, [esp + 0x118]
push str.:7:RefreshSales___EAP:_OUTER_ExecuteODBCFormat__SALES_YEAR_MONTH_04d__02d__02d_OR_SALES_YEAR_MONTH_04d__02d__02d__AND_LOC_d_FAILED:__s
push 0x100
push eax
call fcn.0047da40
add esp, 0x2c
cmp dword [esp + 0x20], 0
jle 0x475b08
xor edi, edi
inc edi
xor esi, esi
cmp dword [esp + 0x18], esi
mov dword [ebx + 0x2f90], edi
je 0x475d1d
cmp dword [ebx + 0x2f98], esi
jne 0x475ddf
cmp dword [ebx + 0x44], esi
je 0x475cfa
cmp dword [ebx + 0x38], esi
je 0x475cfa
mov ecx, ebx
call fcn.0047699c
call fcn.00476990
test eax, eax
je 0x475ce8
mov eax, ebx
call fcn.0047549a
mov ecx, ebx
call fcn.0047699c
test eax, eax
jne 0x475cd2
lea eax, [esp + 0x78]
push eax
push str.:8:RefreshSales___Critical_Exception_:_PostSales___says_EOD_has_NOT_been_encountered__This_will_result_in_EOD_never_being_posted___s
call fcn.004178df
pop ecx
pop ecx
push str.:0:FYI:_End_Of_Day_process_has_begun.__TAMS_II_
mov dword [ebx + 0x2f98], edi
call fcn.00417db7
pop ecx
jmp 0x475ddf
lea eax, [esp + 0x78]
push eax
push str.:5:RefreshSales___EAP:_End_of_Day_process_has_begun__but_the_initial_PostSalesResult___FAILED:_EOD_cannot_be_posted._Another_attempt_will_be_made:__s
call fcn.004178df
pop ecx
jmp 0x475ce2
lea eax, [esp + 0x78]
push eax
push str.:2:RefreshSales___EAP:_EOD_has_been_detected_from_zero_sales.__This_may_happen_when_the_server_is_started_after_EOD.__EOD_has_been_ignored:__s
call fcn.00417db7
pop ecx
pop ecx
mov eax, ebx
call fcn.0047549a
mov dword [ebx + 0x2f98], edi
jmp 0x475ddf
mov ecx, ebx
mov dword [ebx + 0x2f98], esi
call fcn.0047699c
test eax, eax
je 0x475ddf
lea eax, [esp + 0x78]
push eax
push dword [ebx + 0x38]
call fcn.0043e797
pop ecx
push eax
push str.:9:RefreshSales___Critical_Exception_:_PostSales___says_EOD_has_been_encountered__This_should_never_happen._NetSales___s:__s
call fcn.004178df
movzx eax, word [0x63ae40]
add esp, 0xc
push dword [0x63ae44]
push eax
movzx eax, word [0x63ae3c]
push eax
push dword [0x637e2c]
movzx eax, word [0x634e72]
push eax
movzx eax, word [0x637e82]
push eax
push dword [0x634e68]
push dword [0x637e78]
push dword [0x634e64]
push dword [0x637e74]
push dword [0x634e58]
call fcn.0043e797
pop ecx
push eax
push dword [0x637e68]
call fcn.0043e797
pop ecx
push eax
push dword [0x637db0]
push dword [0x63adc0]
push esi
sub esp, 0x10
mov esi, 0x634e10
mov edi, esp
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call fcn.004a4452
add esp, 0x14
push eax
push str.:9:RefreshSales___DEBUG:_SnapShot_at__s:_bIsTAMSii_d__d__tNetSales_s__s__iNumInvoices_d__d__iNumVoids_d__d__wDay_d__d:_STATICS:_dwTimeLastParse_d__wLastDayParsed_d__wLastDayEOD_d__iNumTimesInitTried_d
call fcn.004178df
add esp, 0x40
xor esi, esi
xor eax, eax
mov dword [0x53579c], esi
inc eax
jmp 0x475e06
lea eax, [esp + 0x78]
push eax
lea eax, [esp + 0xfc]
push eax
push str.:5:FYI:_TAMSii_SA7_FAILED:__s:__s
call fcn.004178df
add esp, 0xc
xor eax, eax
mov ecx, dword [esp + 0x5fc]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.004b4c95
mov esp, ebp
pop ebp
ret