Function MyFata310() Local aCabec := {} Local aItens := {} Local aLinha := {} Local nX := 0 Local nY := 0 Local lOk := .T. PRIVATE lMsErroAuto := .F. ConOut(Repl("-",80)) ConOut(PadC("Teste de Inclusao de 10 apontamentos de venda com 1 item cada",80)) PREPARE ENVIRONMENT EMPRESA "99" FILIAL "01" MODULO "FAT" dbSelectArea("SA3") dbSetOrder(1) If !SA3->(DbSeek(xFilial("SA3")+"V00001")) lOk := .F. ConOut("Cadastrar vendedor: V00001") EndIf If !SB1->(DbSeek(xFilial("SB1")+"PA001")) lOk := .F. ConOut("Cadastrar produto: PA001") EndIf dbSelectArea("SA1") dbSetOrder(1) If !SA1->(DbSeek(xFilial("SA1")+"CL000101")) lOk := .F. ConOut("Cadastrar cliente: CL000101") EndIf
If lOk ConOut("Inicio: "+Time()) For nY := 1 To 10 aCabec := {} aItens := {} aadd(aCabec,{"AD5_VEND" ,"V00001",Nil}) aadd(aCabec,{"AD5_DATA" ,dDataBase,Nil}) aadd(aCabec,{"AD5_SEQUEN" ,StrZero(nY,2),Nil}) aadd(aCabec,{"AD5_CODCLI",SA1->A1_COD,Nil}) aadd(aCabec,{"AD5_LOJA",SA1->A1_LOJA,Nil}) For nX := 1 To 30 aLinha := {} aadd(aLinha,{"AD6_ITEM",StrZero(nX,2),Nil}) aadd(aLinha,{"AD6_CODPRO",SB1->B1_COD,Nil}) aadd(aLinha,{"AD6_QUANT",1,Nil}) aadd(aLinha,{"AD6_VLUNIT",100,Nil}) aadd(aLinha,{"AD6_TOTAL",100,Nil}) aadd(aItens,aLinha) Next nX //Teste de Inclusao FATA310(aCabec,aItens,3) If !lMsErroAuto ConOut("Incluido com sucesso! ") Else ConOut("Erro na inclusao!") EndIf Next nY ConOut("Fim : "+Time()) //Teste de alteracao aCabec := {} aItens := {} aadd(aCabec,{"AD5_VEND" ,"V00001",Nil}) aadd(aCabec,{"AD5_DATA" ,dDataBase,Nil}) aadd(aCabec,{"AD5_SEQUEN" ,StrZero(nY,2),Nil}) aadd(aCabec,{"AD5_CODCLI",SA1->A1_COD,Nil}) aadd(aCabec,{"AD5_LOJA",SA1->A1_LOJA,Nil}) For nX := 1 To 30 aLinha := {} aadd(aLinha,{"AD6_ITEM",StrZero(nX,2),Nil}) aadd(aLinha,{"AD6_CODPRO",SB1->B1_COD,Nil}) aadd(aLinha,{"AD6_QUANT",2,Nil}) aadd(aLinha,{"AD6_VLUNIT",100,Nil}) aadd(aLinha,{"AD6_TOTAL",200,Nil}) aadd(aItens,aLinha) Next nX ConOut(PadC("Teste de alteracao",80)) ConOut("Inicio: "+Time()) FATA310(aCabec,aItens,4) ConOut("Fim : "+Time()) ConOut(Repl("-",80)) //Teste de Exclusao ConOut(PadC("Teste de exclusao",80)) ConOut("Inicio: "+Time()) FATA310(aCabec,aItens,5) If !lMsErroAuto ConOut("Exclusao com sucesso! ") Else ConOut("Erro na exclusao!") EndIf ConOut("Fim : "+Time()) ConOut(Repl("-",80)) EndIf RESET ENVIRONMENT Return(.T.) |