When we try to save any changes in scx with Ctrl+S, it takes very long time if foxcodeplus is running ?
For testing start vfp9 with Foxcodeplus 3.11, Create a Form and paste below code in a method and press Ctrl+S
```
** Code start
**** Form1.AccountUpdate
select 0
zfile = npp + 'ledger'
use (zfile) in 0 alias oledger share
select oledger
select vno, date, billno, billdt, refno, accode, acname, type, sum(iif(type = 'D', amt, -1 * amt)) as amt, status, vtype, part ;
from oledger group by accode into dbf cop
use in oledger
use in cop
select 0
zfile = npp + 'ledger2'
use (zfile) in 0 alias oledger2 share
select oledger2
select space(8) as billno2, vno, date, billno, billdt, refno, accode, acname, ;
max(smancode) as smancode, ;
type, sum(iif(type = 'D', amt, -1 * amt)) as amt, status, vtype, part, max(duedate) as duedate, ;
max(compcode1) as compcode1, ;
max(compcode2) as compcode2, ;
max(compcode3) as compcode3, ;
max(compcode4) as compcode4, ;
max(compcode5) as compcode5, ;
max(compcode6) as compcode6, ;
max(compcode7) as compcode7, ;
max(compcode8) as compcode8, ;
max(compcode9) as compcode9, ;
max(compcode10) as compcode10, ;
max(compcode11) as compcode11, ;
max(compcode12) as compcode12, ;
max(compcode13) as compcode13, ;
max(compcode14) as compcode14, ;
max(compcode15) as compcode15, ;
sum(compamt1) as compamt1, ;
sum(compamt2) as compamt2, ;
sum(compamt3) as compamt3, ;
sum(compamt4) as compamt4, ;
sum(compamt5) as compamt5, ;
sum(compamt6) as compamt6, ;
sum(compamt7) as compamt7, ;
sum(compamt8) as compamt8, ;
sum(compamt9) as compamt9, ;
sum(compamt10) as compamt10, ;
sum(compamt11) as compamt11, ;
sum(compamt12) as compamt12, ;
sum(compamt13) as compamt13, ;
sum(compamt14) as compamt14, ;
sum(compamt15) as compamt15 ;
from ledger2 group by accode, billno into dbf ccop
use in oledger2
use in ccop
use cop again in 0 exclusive
select cop
delete all for amt = 0
replace all vno with recno()
replace all date with zstartdate - 1
replace all refno with alltrim(str(vno))
replace all billno with '-1 '
replace all billdt with zstartdate - 1
replace all type with 'D' for amt > 0
replace all type with 'C' for amt <= 0
replace all part with 'Opening'
replace all status with 'OP'
replace all vtype with 'Obal'
replace all amt with - 1 * amt for amt < 0
select cop
pack in cop
copy structure to cop2
use ccop again in 0 exclusive
select ccop
delete all for amt = 0
replace all vno with recno()
replace all date with zstartdate - 1 for empty(date)
replace all refno with alltrim(str(vno))
replace all billno2 with billno
*If zstarbill='*'
* Replace All billno With Padl(Alltrim(Str(Val(billno)))+'*',6,'0')
*Else
* Replace All billno With Padl('O'+Alltrim(Str(Val(billno))),6,'0')
*Endif
replace all billdt with zstartdate - 1 for empty(billdt)
replace all type with 'D' for amt > 0
replace all type with 'C' for amt <= 0
replace all part with 'Opening'
replace all status with 'OP'
replace all vtype with 'Obal'
replace all amt with - 1 * amt for amt < 0
select ccop
pack in ccop
copy structure to ccop2
wait window zdatapath nowait
= usefile2("cop2")
= usefile2("ccop2")
= usefile("customer")
= usefile("opening")
= usefile("opening1")
select opening
delete all for empty(opfinal) in opfinal
select opening1
delete all for empty(opfinal) in opfinal1
select opening
set order to vno
go bottom
local lnvno
lnvno = opening.vno + 1
select customer
set order to accode
select cop
goto top
do while !eof()
scatter memvar
if seek(m.accode, 'customer', 'accode') and customer.grtype = 'B'
select cop2
append blank
gather memvar
replace vno with m.lnvno in cop2
replace refno with alltrim(str(m.lnvno)) in cop2
lnvno = lnvno + 1
endif
select cop
skip
enddo
set talk off
set talk nowindow
select 0
zfile = npp + 'ledger2'
use (zfile) in 0 alias oledger2 share
select oledger2
index on accode + billno to led22
*Set Order To accode
select ccop
xxrec = reccount()
xxrr = 1
goto top
do while !eof()
scatter memvar
wait window str(xxrr) + ' of ' + str(xxrec) nowait
mkey = m.accode + m.billno2
if seek(m.accode, 'customer', 'accode') and customer.grtype = 'B'
select oledger2
seek mkey
do while accode = m.accode and billno = m.billno2
if accode = m.accode and billno = m.billno2
select ccop2
append blank
replace vno with m.vno, date with oledger2.date, billno with m.billno, ;
billdt with oledger2.billdt, refno with m.refno, ;
accode with m.accode, acname with m.acname, type with oledger2.type, ;
amt with oledger2.amt, ;
status with 'OP', vtype with 'Obal', part with 'Opening Balance', ;
smancode with oledger2.smancode
replace duedate with oledger2.duedate, ;
compcode1 with oledger2.compcode1, ;
compcode2 with oledger2.compcode2, ;
compcode3 with oledger2.compcode3, ;
compcode4 with oledger2.compcode4, ;
compcode5 with oledger2.compcode5, ;
compcode6 with oledger2.compcode6, ;
compcode7 with oledger2.compcode7, ;
compcode8 with oledger2.compcode8, ;
compcode9 with oledger2.compcode9, ;
compcode10 with oledger2.compcode10, ;
compcode11 with oledger2.compcode11, ;
compcode12 with oledger2.compcode12, ;
compcode13 with oledger2.compcode13, ;
compcode14 with oledger2.compcode14, ;
compcode15 with oledger2.compcode15, ;
compamt1 with oledger2.compamt1, ;
compamt2 with oledger2.compamt2, ;
compamt3 with oledger2.compamt3, ;
compamt4 with oledger2.compamt4, ;
compamt5 with oledger2.compamt5, ;
compamt6 with oledger2.compamt6, ;
compamt7 with oledger2.compamt7, ;
compamt8 with oledger2.compamt8, ;
compamt9 with oledger2.compamt9, ;
compamt10 with oledger2.compamt10, ;
compamt11 with oledger2.compamt11, ;
compamt12 with oledger2.compamt12, ;
compamt13 with oledger2.compamt13, ;
compamt14 with oledger2.compamt14, ;
compamt15 with oledger2.compamt15
endif
select oledger2
skip
enddo
endif
select ccop
xxrr = xxrr + 1
skip
enddo
use in oledger2
= usefile("ledger")
= usefile("ledger2")
set talk on
set talk window
select ccop2
index on accode to accop2
goto top
select cop2
index on accode to accop
goto top
sum all amt for type = 'D' to xdop
sum all amt for type = 'C' to xcop
xabal = xdop - xcop
xoname = 'PROFIT & LOSS PREVIOUS YEAR '
if seek(upper(xoname), "CUSTOMER", "ACNAME")
if xabal > 0
select cop2
append blank in cop2
replace vno with recno() ;
date with zstartdate - 1 ;
refno with alltrim(str(vno)) ;
billno with '-1 ' ;
billdt with zstartdate - 1 ;
type with 'C' ;
part with 'Opening' ;
status with 'OP' ;
vtype with 'Obal' ;
amt with abs(xabal) ;
in cop2
replace acname with customer.acname, ;
accode with customer.accode
else
select cop2
append blank in cop2
replace vno with recno() ;
date with zstartdate - 1 ;
refno with alltrim(str(vno)) ;
billno with '-1 ' ;
billdt with zstartdate - 1 ;
type with 'D' ;
part with 'Opening' ;
status with 'OP' ;
vtype with 'Obal' ;
amt with abs(xabal) ;
in cop2
replace acname with customer.acname, ;
accode with customer.accode
endif
else
wait window "A/c " + xoname + " Not Found Please Create this A/c"
endif
select dist accode from opening into dbf xo
select xo
goto top
do while !eof()
mmac = accode
select cop2
seek mmac
do while accode = mmac and !eof()
delete in cop2
skip
enddo
select ccop2
seek mmac
do while accode = mmac and !eof()
delete in ccop2
skip
enddo
select xo
skip
enddo
select cop2
goto top
select ledger
delete all for status = 'OP' and empty(opfinal) in ledger
select ledger
append from cop2
select ledger2
delete all for status = 'OP' and empty(opfinal) in ledger2
select ledger2
set talk off
set talk nowind
select cop2
goto top
do while !eof()
scatter memvar
wait wind M.accode nowa
select opening
append blank in opening
replace vno with cop2.vno, openingdt with m.date, opening with m.refno, acname with m.acname, accode with m.accode in opening
if m.type = 'D'
replace totaldr with m.amt ;
totalbal with m.amt ;
total with alltrim(str(m.amt, 12, 2)) + 'Dr' ;
in opening
endif
if m.type = 'C'
replace totalcr with m.amt ;
totalbal with m.amt ;
total with alltrim(str(m.amt, 12, 2)) + 'Cr' ;
in opening
endif
if seek(m.accode, 'customer', 'accode') and ('CREDITOR' $ upper(customer.actype) or 'CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname) or 'SUPPLIER' $ upper(customer.prtname) or 'CREDITOR' $ upper(customer.prtname) or 'MANUF' $ upper(customer.prtname))
select ccop2
seek m.accode
do while accode = m.accode and !eof()
select opening1
append blank in opening1
replace vno with cop2.vno, openingdt with m.date, opening with m.refno, acname with ccop2.acname, accode with m.accode
replace type with ccop2.type, billno with ccop2.billno, billdt with ccop2.billdt, opamt with ccop2.amt
if zstarbill = '*'
do case
case val(ccop2.billno) = 0 and seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with ccop2.billno
case '*' $ ccop2.billno and seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with padl(alltrim(str(val(ccop2.billno))) + 'X', 6, '0')
case seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with padl(alltrim(str(val(ccop2.billno))) + '*', 6, '0')
Warm regards,
mk.
Comments: ** Comment from web user: mk_common **
For testing start vfp9 with Foxcodeplus 3.11, Create a Form and paste below code in a method and press Ctrl+S
```
** Code start
**** Form1.AccountUpdate
select 0
zfile = npp + 'ledger'
use (zfile) in 0 alias oledger share
select oledger
select vno, date, billno, billdt, refno, accode, acname, type, sum(iif(type = 'D', amt, -1 * amt)) as amt, status, vtype, part ;
from oledger group by accode into dbf cop
use in oledger
use in cop
select 0
zfile = npp + 'ledger2'
use (zfile) in 0 alias oledger2 share
select oledger2
select space(8) as billno2, vno, date, billno, billdt, refno, accode, acname, ;
max(smancode) as smancode, ;
type, sum(iif(type = 'D', amt, -1 * amt)) as amt, status, vtype, part, max(duedate) as duedate, ;
max(compcode1) as compcode1, ;
max(compcode2) as compcode2, ;
max(compcode3) as compcode3, ;
max(compcode4) as compcode4, ;
max(compcode5) as compcode5, ;
max(compcode6) as compcode6, ;
max(compcode7) as compcode7, ;
max(compcode8) as compcode8, ;
max(compcode9) as compcode9, ;
max(compcode10) as compcode10, ;
max(compcode11) as compcode11, ;
max(compcode12) as compcode12, ;
max(compcode13) as compcode13, ;
max(compcode14) as compcode14, ;
max(compcode15) as compcode15, ;
sum(compamt1) as compamt1, ;
sum(compamt2) as compamt2, ;
sum(compamt3) as compamt3, ;
sum(compamt4) as compamt4, ;
sum(compamt5) as compamt5, ;
sum(compamt6) as compamt6, ;
sum(compamt7) as compamt7, ;
sum(compamt8) as compamt8, ;
sum(compamt9) as compamt9, ;
sum(compamt10) as compamt10, ;
sum(compamt11) as compamt11, ;
sum(compamt12) as compamt12, ;
sum(compamt13) as compamt13, ;
sum(compamt14) as compamt14, ;
sum(compamt15) as compamt15 ;
from ledger2 group by accode, billno into dbf ccop
use in oledger2
use in ccop
use cop again in 0 exclusive
select cop
delete all for amt = 0
replace all vno with recno()
replace all date with zstartdate - 1
replace all refno with alltrim(str(vno))
replace all billno with '-1 '
replace all billdt with zstartdate - 1
replace all type with 'D' for amt > 0
replace all type with 'C' for amt <= 0
replace all part with 'Opening'
replace all status with 'OP'
replace all vtype with 'Obal'
replace all amt with - 1 * amt for amt < 0
select cop
pack in cop
copy structure to cop2
use ccop again in 0 exclusive
select ccop
delete all for amt = 0
replace all vno with recno()
replace all date with zstartdate - 1 for empty(date)
replace all refno with alltrim(str(vno))
replace all billno2 with billno
*If zstarbill='*'
* Replace All billno With Padl(Alltrim(Str(Val(billno)))+'*',6,'0')
*Else
* Replace All billno With Padl('O'+Alltrim(Str(Val(billno))),6,'0')
*Endif
replace all billdt with zstartdate - 1 for empty(billdt)
replace all type with 'D' for amt > 0
replace all type with 'C' for amt <= 0
replace all part with 'Opening'
replace all status with 'OP'
replace all vtype with 'Obal'
replace all amt with - 1 * amt for amt < 0
select ccop
pack in ccop
copy structure to ccop2
wait window zdatapath nowait
= usefile2("cop2")
= usefile2("ccop2")
= usefile("customer")
= usefile("opening")
= usefile("opening1")
select opening
delete all for empty(opfinal) in opfinal
select opening1
delete all for empty(opfinal) in opfinal1
select opening
set order to vno
go bottom
local lnvno
lnvno = opening.vno + 1
select customer
set order to accode
select cop
goto top
do while !eof()
scatter memvar
if seek(m.accode, 'customer', 'accode') and customer.grtype = 'B'
select cop2
append blank
gather memvar
replace vno with m.lnvno in cop2
replace refno with alltrim(str(m.lnvno)) in cop2
lnvno = lnvno + 1
endif
select cop
skip
enddo
set talk off
set talk nowindow
select 0
zfile = npp + 'ledger2'
use (zfile) in 0 alias oledger2 share
select oledger2
index on accode + billno to led22
*Set Order To accode
select ccop
xxrec = reccount()
xxrr = 1
goto top
do while !eof()
scatter memvar
wait window str(xxrr) + ' of ' + str(xxrec) nowait
mkey = m.accode + m.billno2
if seek(m.accode, 'customer', 'accode') and customer.grtype = 'B'
select oledger2
seek mkey
do while accode = m.accode and billno = m.billno2
if accode = m.accode and billno = m.billno2
select ccop2
append blank
replace vno with m.vno, date with oledger2.date, billno with m.billno, ;
billdt with oledger2.billdt, refno with m.refno, ;
accode with m.accode, acname with m.acname, type with oledger2.type, ;
amt with oledger2.amt, ;
status with 'OP', vtype with 'Obal', part with 'Opening Balance', ;
smancode with oledger2.smancode
replace duedate with oledger2.duedate, ;
compcode1 with oledger2.compcode1, ;
compcode2 with oledger2.compcode2, ;
compcode3 with oledger2.compcode3, ;
compcode4 with oledger2.compcode4, ;
compcode5 with oledger2.compcode5, ;
compcode6 with oledger2.compcode6, ;
compcode7 with oledger2.compcode7, ;
compcode8 with oledger2.compcode8, ;
compcode9 with oledger2.compcode9, ;
compcode10 with oledger2.compcode10, ;
compcode11 with oledger2.compcode11, ;
compcode12 with oledger2.compcode12, ;
compcode13 with oledger2.compcode13, ;
compcode14 with oledger2.compcode14, ;
compcode15 with oledger2.compcode15, ;
compamt1 with oledger2.compamt1, ;
compamt2 with oledger2.compamt2, ;
compamt3 with oledger2.compamt3, ;
compamt4 with oledger2.compamt4, ;
compamt5 with oledger2.compamt5, ;
compamt6 with oledger2.compamt6, ;
compamt7 with oledger2.compamt7, ;
compamt8 with oledger2.compamt8, ;
compamt9 with oledger2.compamt9, ;
compamt10 with oledger2.compamt10, ;
compamt11 with oledger2.compamt11, ;
compamt12 with oledger2.compamt12, ;
compamt13 with oledger2.compamt13, ;
compamt14 with oledger2.compamt14, ;
compamt15 with oledger2.compamt15
endif
select oledger2
skip
enddo
endif
select ccop
xxrr = xxrr + 1
skip
enddo
use in oledger2
= usefile("ledger")
= usefile("ledger2")
set talk on
set talk window
select ccop2
index on accode to accop2
goto top
select cop2
index on accode to accop
goto top
sum all amt for type = 'D' to xdop
sum all amt for type = 'C' to xcop
xabal = xdop - xcop
xoname = 'PROFIT & LOSS PREVIOUS YEAR '
if seek(upper(xoname), "CUSTOMER", "ACNAME")
if xabal > 0
select cop2
append blank in cop2
replace vno with recno() ;
date with zstartdate - 1 ;
refno with alltrim(str(vno)) ;
billno with '-1 ' ;
billdt with zstartdate - 1 ;
type with 'C' ;
part with 'Opening' ;
status with 'OP' ;
vtype with 'Obal' ;
amt with abs(xabal) ;
in cop2
replace acname with customer.acname, ;
accode with customer.accode
else
select cop2
append blank in cop2
replace vno with recno() ;
date with zstartdate - 1 ;
refno with alltrim(str(vno)) ;
billno with '-1 ' ;
billdt with zstartdate - 1 ;
type with 'D' ;
part with 'Opening' ;
status with 'OP' ;
vtype with 'Obal' ;
amt with abs(xabal) ;
in cop2
replace acname with customer.acname, ;
accode with customer.accode
endif
else
wait window "A/c " + xoname + " Not Found Please Create this A/c"
endif
select dist accode from opening into dbf xo
select xo
goto top
do while !eof()
mmac = accode
select cop2
seek mmac
do while accode = mmac and !eof()
delete in cop2
skip
enddo
select ccop2
seek mmac
do while accode = mmac and !eof()
delete in ccop2
skip
enddo
select xo
skip
enddo
select cop2
goto top
select ledger
delete all for status = 'OP' and empty(opfinal) in ledger
select ledger
append from cop2
select ledger2
delete all for status = 'OP' and empty(opfinal) in ledger2
select ledger2
set talk off
set talk nowind
select cop2
goto top
do while !eof()
scatter memvar
wait wind M.accode nowa
select opening
append blank in opening
replace vno with cop2.vno, openingdt with m.date, opening with m.refno, acname with m.acname, accode with m.accode in opening
if m.type = 'D'
replace totaldr with m.amt ;
totalbal with m.amt ;
total with alltrim(str(m.amt, 12, 2)) + 'Dr' ;
in opening
endif
if m.type = 'C'
replace totalcr with m.amt ;
totalbal with m.amt ;
total with alltrim(str(m.amt, 12, 2)) + 'Cr' ;
in opening
endif
if seek(m.accode, 'customer', 'accode') and ('CREDITOR' $ upper(customer.actype) or 'CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname) or 'SUPPLIER' $ upper(customer.prtname) or 'CREDITOR' $ upper(customer.prtname) or 'MANUF' $ upper(customer.prtname))
select ccop2
seek m.accode
do while accode = m.accode and !eof()
select opening1
append blank in opening1
replace vno with cop2.vno, openingdt with m.date, opening with m.refno, acname with ccop2.acname, accode with m.accode
replace type with ccop2.type, billno with ccop2.billno, billdt with ccop2.billdt, opamt with ccop2.amt
if zstarbill = '*'
do case
case val(ccop2.billno) = 0 and seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with ccop2.billno
case '*' $ ccop2.billno and seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with padl(alltrim(str(val(ccop2.billno))) + 'X', 6, '0')
case seek(m.accode, 'customer', 'accode') and ('CUSTOMER' $ upper(customer.prtname) or 'DEBTORS' $ upper(customer.prtname))
replace billno with padl(alltrim(str(val(ccop2.billno))) + '*', 6, '0')
Warm regards,
mk.
Comments: ** Comment from web user: mk_common **
But without FoxcodePlus it is working normal.
Only problem with Ctrl+S , if we save with ' File->Save ' then Working Properly.
If we issue a ' clear all ' command in command window (To clear FoxcodePlus) and use Ctrl+S then also working properly.
Warm regards,
mk.