PURCHASE ORDER DETAIL UPDATE
Private Sub_Click PODetailUpdate Form
open.database SGF
open.database POMF
open.database PODF
open.database SMF
open.database MMF
open.database PRDF
lblCname ==SGF!Comname
lblCadd==SGF!comaddress
Input txtPONo
SEEK(POMF.databasetable(txtPONo))
IF NOMATCH
{
Print "PO number not Found"
}
Else if NOMATCHi
{
Print "PO number is already Closed
}
END IF
SEEK SMF.databasetable(POMF!SNo)
if NOMATCH
{
end if
}
else
{
txtSNo==POMF!SNo
txtSName==SMF!Name+smf!slname
txtSadd==SMF!Saddress
}
end if
row==1
SEEK POMF.databasetable(POMF!PONo)
if NOMATCH
{
END IF
}
ELSE
{
grd.PONo(row)==PODF!PONo
grd.PRNo(row)==PODF!PRNo
grd.MNO(row)==PODF!mno
grd.QOrd(row)==PODF!Qty_ordered
grd.Uprice(row)==PODF!U_price
grd.amount(row)==PODF!Amount
grd.Status(row)==PODF!PODFRECSTAT
}
end if
row==row+1
PODF.movenext
IF NOT EOF or PODF!PONO <> POMF!PONO
{
SEEK POMF.databasetable(POMF!PONo)
}
else
{
row1==1
found ==0
}
END IF
INPUT txtPRNo
INPUT txtMno
SEEK PODF!(txtPONo)
if NOMATCH
{
END IF
}
ELSE
{
SEEK PODF(txtPRNo, MNo)
}
enf if
if nomatch
{
end if
}
else
{
found ==1
grd1.PRNO(row1)==txtPRNo
grd1.PRNO(row1)==txtMNO
grd1.PRNO(row1)==PODF!QTYORDERED
grd1.PRNO(row1)==PODF!U_PRICE
grd1.PRNO(row1)==AMOUNT
}
end if
SEEK MMF(txtMNo)
IF NOMATCH
{
end if
}
else
{
grd1.description(row1)=MMF!Description
}
end if
PODF.MOVENEXT
IF NOT EOF or PODF!PRNO <> TXTPRNO or PODF!MNO <>TXTMNO
{
END IF
}
ELSE
{
PODF.MOVENEXT
}
END IF
IF NOT EOF or PODF!PONO<>TXTPONO
{
end if
}
else
{
found ==0
}
end if
if found ==0
{
Print " PR Number and Material number not found"
}
else
{
input txtqty
}
end if
grd1.Qord(row1)==txtQTy
Amount==grd1.Qord(row1) * grd1.Uprice(row1)
grd1.Amount(row1)==Amount
row1==row1+1
End sub
Private Sub_Click cmdUpdate
if row1==1
{
Print "No Data to be Update"
}
else
{
found==0
}
end if
LOOP i=1 to row-1
SEEK PODF(txtPono)
if nomatch
{
return LOOP
}
ELSE
{
SEEK PODF(txtPONO.grd1,Mno(row1))
if NOMATCH
{
end if
}
else
{
found ==1
}
grd1.QORD(row1)>PODF!QTY_ORDERED - grd1.QORD(row1)
tmpPro==tmpSub+grd1.Qord(row1)
}
if tmpPro<>PODF!QTY_ORDERED
{
end if
}
else
{
PODF.EDIT
PODF!QTY_ORDERED==grd1.qord(row1)
PODF.UPDATE
}
END IF
SEEK PRDF (grd1 PRNo(row1), grd1.MNo(row1))
if NOMATCH
{
Print" Error Updating in PR DETAIL FILE"
}
ELSE
{
PODF.EDIT
PODF!QTY_ORDERED==grd1.QORD(row1)
}
end if
IF PRDF!QTY_ORDERED <> PRDF!QTY_REQUIRED
{
end if
}
else
PRDF!PRDFREcstat=="C"
found==0
}
end if
SEEK PRDF(grd1.PRNO(row1))
IF NOMATCH
{
end if
}
else IF PRDF!PRDFRECSTAT="O"
{
END IF
}
ELSE
{
FOUND1 == 1
PRDF.MOVENEXT
IF NOT EOF OR PRDF!PRNo<> grd1.PRNo(row1)
{
end if
}
else if found == 0
{
end if
}
else
{
SEEK PRMF(grd1.PRNO(row1))
}
end if
if nomatch
{
Print"ERROR UPDATING IN PR DETAIL FILE"
}
ELSE
{
PRMF.EDIT
PRMF!PRMFRECSTAT=="C"
PRMF.UPDATE
}
PODF.MOVENEXT
IF NOT EOF OR PODF!PRNO<>grd1.PRNo(row1)
PODG!MNO<>grd1.MNO(row1)
{
end if
}
ELSE
{
PODF.MOVENEXT
}
END IF
IF NOT EOF Or PODF!PRNO<>grd1.PRNO(row1)
{
exit sub
}
else
{
clearall fields
}
end if
End sub
Private Sub_click cmdcancel
clearall.fields
end sub
Private Sub_Click cmdexit
close.database SGF
close.database POMF
close.database PODF
close.database SMF
close.database PRDF
END SUB
Home »
» PURCHASE ORDER DETAIL UPDATE by Quantity Ordered SYNTAX