DEFINE WINDOW oWndChild MDICHILD;
FROM aWin[01],aWin[02] TO aWin[03], aWin[04] ;
TITLE cTitle ;
COLOR "N/W" ;
ICON oWnd:oIcon;
NOMAXIMIZE ;
OF oWnd
DEFINE DIALOG oDlg RESOURCE cDlg OF oWndChild FONT oWnd:oFont
REDEFINE GET aDatax["93"] VAR aCliente[ ID_SOCIO ]; // oCdg
REDEFINE SAY aDatax["94"] PROMPT aCliente[ ID_NOMBRE ] ID 94 OF oDlg UPDATE
REDEFINE SAY aDatax["197"] PROMPT aCliente[ ID_DOMICI ] ID 197 OF oDlg UPDATE
REDEFINE SAY aDatax["54"] PROMPT aCliente[ ID_TELEFO ] ID 54 OF oDlg UPDATE
REDEFINE SAY aDatax["54"] PROMPT aTxtIva[ aCliente[ ID_CF ] ] ID 4009 OF oDlg UPDATE
REDEFINE SAY aDatax["54"] PROMPT aCliente[ ID_CUIT ] ID 4011 OF oDlg UPDATE
REDEFINE GET aDatax["107"] VAR aCliente[ ID_CLACOM ] ;
REDEFINE GET aDatax["108"] VAR aCliente[ ID_CODVTA ] ;
REDEFINE GET aDatax["62"] VAR aCliente[ ID_NROCOM ] ;
REDEFINE GET aDatax["4001"] VAR aCliente[ ID_NROPED ] ;
REDEFINE GET aDatax["90"] VAR aCliente[ ID_FECHA ];
REDEFINE GET aDatax["53"] VAR aCliente[ ID_FECVTO ];
REDEFINE GET aDatax["4004"] VAR aCliente[ ID_FECHAE ];
oLbx[3]:= TXBrowse():New( oDlg )
oBar[1] := TC5StBar():Redefine( 4003, oDlg, oApp:nStBarColor1, oApp:nStBarColor2, .f., oWnd:oFont )
oBar[1]:lRightToLeft := .f.
oBar[1]:lBorder := oApp:BarC5StBorder
oBar[1]:AddItem( "Nuevo", cBmpNew,{|| ( NewReg( oLbx[1], aCliente, lPorArt ), oLbx[1]:SetFocus(),.t.) }, {|| .t.}, .f., "Añadir item" )
oBar[1]:AddItem( "", cBmpAnular,{|| (DelReg( oLbx, aCliente, lPorArt ),oLbx[1]:SetFocus(),.t.) }, {|| aCliente[ID_SOCIO]#0.and.Len(oLbx[1]:aArrayData)>0}, .f., "Eliminar" )
aColumns:= { ID_CODART, ID_NOMART, ID_CANART, ID_COSART, ID_BONIF1, ID_BONIF2, ID_BONIF3, ID_BONIF4, ID_BONIF5, ID_PREART, ID_IMPART, ID_IVAART, ID_CPBART }
aHeaders:= { "Codigo", "Articulo", "Bultos", "Precio", "%", "%", "%", "%", "%", "Costo", "Importe", "Tasa", "Comprobante" }
aColSize:= { 120, 340, 50, 65, 50, 50, 50, 50, 50, 60, 65, 50, 90 }
aColJust:= { ,, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT }
aColPict:= { ,, oApp:CantidPict, oApp:PrecioPict, "@Z 999.99", "@Z 999.99", "@Z 999.99", "@Z 999.99", "@Z 999.99", oApp:ImportePict, oApp:ImportePict, "@Z 999.99%" }
ndCol:= 6
REDEFINE XBROWSE oLbx[1] ;
COLUMNS aColumns ;
HEADERS aHeaders ;
COLSIZES aColSize ;
JUSTIFY aColJust ;
PICTURE aColPict ;
ID aId[01] ;
OF oDlg ;
ARRAY aDatos LINES FASTEDIT
WITH OBJECT oLbx[1]:InsCol( 1 )
:cHeader := " "
:bEditValue := { || If( AScan( oLbx[1]:aSelected, oLbx[1]:BookMark ) > 0 .and. !empty(oLbx[1]:aArrayData[oLbx[1]:nArrayAt,ID_CODART]), .t., nil ) }
:SetCheck()
:nHeadBmpNo := { || If( Len( oLbx[1]:aSelected ) == oLbx[1]:nLen, 1, 2 ) }
:bLClickHeader := { |r,c,f,oCol| If( Len( oLbx[1]:aSelected ) == oLbx[1]:nLen, oLbx[1]:SelectNone(), oLbx[1]:SelectAll() ) }
END
WITH OBJECT oLbx[1]:Codigo
:cEditPicture := "@X"
:bEditWhen := { || oLbx[1]:aArrayData[oLbx[1]:nArrayAt,ID_FIRST] }
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 1, oLbx[1], aCliente, cPathRs,, oLbx ) }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey<>VK_ESCAPE,( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:RefreshFooters(),;
oLbx[1]:Refresh() ),) }
END WITH
WITH OBJECT oLbx[1]:Articulo
:cEditPicture := "@X"
:bEditWhen := { || !EMPTY( oLbx[1]:aArrayData[oLbx[1]:nArrayAt,ID_CODART] ) } // oLbx[1]:aRow[ID_CODART]
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | !EMPTY( oGet:value ) }
:bOnPreEdit:= { | oCol | oCol:oEditGet:SetPos( 0 ) }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, oCol:value:= xVal,) }
END WITH
WITH OBJECT oLbx[1]:Bultos
:cEditPicture := oApp:CantidPict
:bEditWhen := { || !EMPTY( oLbx[1]:aRow[ID_CODART] ) }
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | oGet:value()>=0 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
oLbx[1]:aArrayData[oLbx[1]:nArrayAt,ID_FIRST]:= .f.,;
Totalizo( oLbx,, aCliente ),;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:SelectCol(ndCol-1),;
oLbx[1]:SetFocus() ), ) }
END WITH
WITH OBJECT oLbx[1]:Precio
:cEditPicture := "@z 999,999.999" // oApp:PrecioPict
:bEditWhen := { || !EMPTY( oLbx[1]:aRow[ID_CODART] ) }
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 4, oLbx[1], aCliente, cPathRs,, oLbx ) }
:bOnPostEdit:= { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),; // TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:SetFocus() ),) }
END WITH
WITH OBJECT oLbx[1]:aCols[ndCol]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditWhen := { || !EMPTY( oLbx[1]:aRow[ID_CODART] ) }
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 3, oLbx[1], aCliente, cPathRs, 1, oLbx ) }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX(aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs),;
oLbx[1]:SetFocus() ),) }
END WITH
WITH OBJECT oLbx[1]:aCols[ndCol+1]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 3, oLbx[1], aCliente, cPathRs, 2, oLbx ) }
:bEditWhen := { || oLbx[1]:aRow[ndCol]#0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX(aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs),;
oLbx[1]:SetFocus() ),) }
END WITH
WITH OBJECT oLbx[1]:aCols[ndCol+2]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 3, oLbx[1], aCliente, cPathRs, 3, oLbx ) }
:bEditWhen := { || oLbx[1]:aRow[ndCol+1]#0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:SetFocus() ),) }
END WITH
WITH OBJECT oLbx[1]:aCols[ndCol+3]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 3, oLbx[1], aCliente, cPathRs, 4, oLbx ) }
:bEditWhen := { || oLbx[1]:aRow[ndCol+2]#0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:SetFocus() ),) }
END WITH
WITH OBJECT oLbx[1]:aCols[ndCol+4]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | Valida( oGet, oCol, 3, oLbx[1], aCliente, cPathRs, 5, oLbx ) }
:bEditWhen := { || oLbx[1]:aRow[ndCol+3]<>0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
Totalizo( oLbx,, aCliente ),;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs),;
oLbx[1]:SetFocus() ),) }
END WITH
if ASCAN( aHeaders, "Tasa" ) > 0
WITH OBJECT oLbx[1]:Tasa
:cEditPicture := "@z 999.99%" // oApp:PrecioPict
:bEditWhen := { || (lPorArt.and.!EMPTY( oLbx[1]:aRow[ID_CODART] ).and.aCliente[ID_TIPCOM]#"N ") .or. ;
(!lPorArt.and.!EMPTY(oLbx[1]:aRow[ID_NOMART]).AND.oLbx[1]:aRow[ID_EXEART]#"S" ) }
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal,;
TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
oLbx[1]:SetFocus() ), ) }
END WITH
endif
WITH OBJECT oLbx[1]
:lRecordSelector:= .f.
:lMultiSelect := .f.
:lEdit := .t.
:nStretchCol := STRETCHCOL_LAST
:lAllowColSwapping := .f.
:bPastEof := { || NewReg( oLbx[1], aCliente, lPorArt ) }
:bKeyDown := {| nKey | Pulsar( nKey, aCliente, oLbx, lPorArt, nParam, oWnd, cPathRs, oWndChild, oDlg ) }
:bGotFocus := { || ( if(LEN(oLbx[1]:aArrayData)==0,(NewReg(oLbx[1], aCliente, lPorArt ),oLbx[1]:SelectCol(IF(lPorArt,02,01))),),oLbx[1]:SetFocus() ) }
:bChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], lPorArt, .f.,, cPathRs ),;
if(aCliente[ID_TIPCOM]=="N ",oLbx[1]:RefreshFooters(),),;
oLbx[1]:SetFocus() ) }
END WITH
REDEFINE XBROWSE oBrwh ;
ID aId[02] ;
OF oDlg ;
ARRAY aDatos
REDEFINE XBROWSE oLbx[2] ;
COLUMNS 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ;
HEADERS "Neto", "%", "%", "%", "%", "$", "SubTotal", "Iva Base", "Iva Adic.", "Exento", aCliente[ID_TITULO_IB,01], "Res.33371", "Imp.Internos", "TOTAL" ;
COLSIZES 70, 50, 50, 50, 50, 60, 70, 70, 70, 70, 70, 90, 70, 90 ;
JUSTIFY AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT, AL_RIGHT ;
PICTURE oApp:TotalPict, "@Z 999.99", "@Z 999.99", "@Z 999.99", "@Z 999.99", oApp:TotalPict, oApp:TotalPict, oApp:TotalPict, ;
oApp:TotalPict, oApp:TotalPict, oApp:TotalPict, oApp:TotalPict, oApp:TotalPict, oApp:TotalPict ;
ID 102 ;
OF oDlg ;
ARRAY aTotales FASTEDIT
WITH OBJECT oLbx[2]:aCols[1]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | oGet:value() >= 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs, xneto ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[2]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditWhen := { || aCliente[ ID_DESCUENTO ] == 0 }
:bEditValid := { | oGet, oCol | oGet:value() >= 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t., .f.,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[3]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | oLbx[2]:aArrayData[ oLbx[2]:nArrayAt,2 ] > 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t., .f.,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[4]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | oLbx[2]:aArrayData[ oLbx[2]:nArrayAt,3 ] > 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t., .f.,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[5]
:cEditPicture := "@Z 999.99"
:nEditType := EDIT_GET
:bEditValid := { | oGet, oCol | oLbx[2]:aArrayData[ oLbx[2]:nArrayAt,4 ] > 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t., .f.,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[6]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bEditWhen := { || TABSUM( oLbx[2]:aArrayData[ oLbx[2]:nArrayAt ],, xdto1, xdto4 ) == 0 }
:bEditValid := { | oGet, oCol | oGet:value >= 0.00 }
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t., .f.,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[7]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[8]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[9]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[10]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[11]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
:cTooltip:= "Sin definir"
END WITH
WITH OBJECT oLbx[2]:aCols[12]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
WITH OBJECT oLbx[2]:aCols[13]
:cEditPicture := oApp:TotalPict
:nEditType := EDIT_GET
:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, ( oCol:value:= xVal ),) }
:bOnChange := { || ( TOTALEX( aCliente,, oLbx[1]:aArrayData, oLbx[2], .t.,,, cPathRs ), oLbx[2]:SetFocus() ) }
END WITH
oLbx[2]:aCols[xtotal]:oDataFont := {|| oApp:FNNegrita }
WITH OBJECT oLbx[2]
#ifndef __XHARBOUR__
:SetStyle( oApp:Style )
#endif
:SetGroupHeader( 'B O N I F I C A C I O N E S', 2, 6 )
:lHScroll:= .F.
:lVScroll:= .f.
:lRecordSelector:= .f.
:lAutoAppend:= .f.
:nStretchCol:= STRETCHCOL_LAST
:bKeyDown := {| nKey | Pulsar( nKey, aCliente, oLbx, lPorArt, nParam, oWnd, cPathRs, oWndChild, oDlg, 2 ) }
:nMarqueeStyle := MARQSTYLE_HIGHLCELL
END WITH
REDEFINE SAY oCbx[1] PROMPT aCliente[ID_CARTEL] ID 92 OF oDlg UPDATE
REDEFINE COMBOBOX oCbx[2] VAR aCliente[ ID_CTIPCOM ] ITEMS aNC ;
ID 91 ;
OF oDlg ;
WHEN LEN(aNC) > 0 ;
VALID if(EstaDato( aCliente[ ID_CTIPCOM ], aCliente, aDatos, /*aGastos*/, oDlg, lPorArt, oLbx[1], cPathRs ),;
( if(LEN(aCliente[ID_TMP])>0,( aDatos:= aCliente[ID_TMP],;
oLbx[1]:SetArray( aDatos ),;
oLbx[1]:Gotop(),;
oLbx[1]:Refresh()),),;
oLbx[1]:SetFocus(),.T.),;
(oLbx[1]:SetFocus(),.T.) ) ;
UPDATE
if oApp:EmpresaId == "64"
REDEFINE SAY oHlp5 PROMPT "Bonificación Oferta:" ID 4002 OF oDlg UPDATE
else
REDEFINE SAY oHlp5 ID 4002 OF oDlg UPDATE
endif
REDEFINE SAY oHlp6 PROMPT if(oApp:EmpresaId$"63,70,88","Fecha Registracion:","Fecha Entrega:") ID 4005 OF oDlg UPDATE
REDEFINE SAY oHlp7 ID 4008 OF oDlg UPDATE
REDEFINE SAY oHlp8 ID 4010 OF oDlg UPDATE
*--------------------------------- FOLDER02 --------------------------------
REDEFINE BUTTONBMP aDatax["550"] ID 550 OF oDlg ;
ACTION ( if( Grabar(aCliente,oLbx[1]:aArrayData,lPorArt,nParam,oCrw,oLbx,cPathRs,oWndChild,oWnd ),;
( Limpiar( aCliente, oDlg ),;
oLbx[1]:aArrayData:= {},;
oLbx[1]:nLen:= 0,;
oLbx[1]:Gotop(),;
oLbx[1]:Refresh(),;
oLbx[1]:RefreshFooters(),;
if(nNotaPedido>0,oWndChild:End(),aDatax["93"]:SetFocus()) ), ) ) ;
PROMPT "&Aceptar" ;
BITMAP cBmpAcept ; // "ok3" ;
TEXTRIGHT ;
TOOLTIP "Guardar"
REDEFINE BUTTONBMP aDatax["551"] ID 551 OF oDlg ;
ACTION oWndChild:End() ;
PROMPT "&Cancelar" ;
CANCEL ;
BITMAP cBmpCancel ; // "anular" ;
TEXTRIGHT
*---------------------------------------------------------------------------
ACTIVATE DIALOG oDlg NOWAIT ON CLICK oDlg:Update ;
ON INIT ( oDlg:move( 0, 0 ) );
valid .f.
ACTIVATE WINDOW oWndChild ;
ON INIT ( oWndChild:SetSize( oDlg:nWidth+16, oDlg:nHeight+37 ),;
aCliente[ID_NEW]:= .F.,;
if(lGrande,oWndChild:Maximize(),),;
if(oApp:lNetBook,oWndChild:Maximize(),),;
aDatax["62"]:Refresh(),;
oBrwh:hide(),;
if(nNotaPedido>0,oLbx[1]:SetFocus(),oDlg:aControls[1]:SetFocus()) ) ;
VALID( DeleteObject(hBmp),;
.T. )
*--------------------------------------------------------------------------------
Static FUNCTION Totalizo( oLbx, nPos, aCliente )
local lRet:= .F.
local cQuery, c3:= "", c2:= "", cMsg:= ""
local nIrA:= 0, n2, nX, n3
local aTmp[5]
DEFAULT nPos:= oLbx[1]:nArrayAt
AFill( aTmp, 0.00 )
IF Len(oLbx[1]:aArrayData) > 0 .and. aCliente[ ID_TIPCOM ] <> "RM"
n2:= oLbx[1]:aArrayData[ nPos, ID_COSART ]
FOR nX:= 1 TO LEN( aTmp )
aTmp[ nX ]:= oLbx[1]:aArrayData[ nPos, nX+(ID_BONIF1-1) ]
if aTmp[ nX ] <> 0.00
n3:= ROUND( ( 100-aTmp[nX] ) / 100, 4 )
n2:= ROUND( n2*n3, 2 )
endif
NEXT
oLbx[1]:aArrayData[ nPos, ID_PREART ]:= n2
oLbx[1]:aArrayData[ nPos, ID_IMPART ]:= ROUND( oLbx[1]:aArrayData[ nPos, ID_CANART ]*n2,2 )
oLbx[1]:Refresh()
if ( oLbx[1]:lFooter )
oLbx[1]:MakeTotals()
oLbx[1]:RefreshFooters()
oLbx[1]:Refresh()
endif
endif
RETURN NIL
//-------------------------------------------------------------------------------
Static Function TOTALEX( aCliente, oDlg, aDatos, oLbx2, lPorArt, lTotalex, nNivel, cPathRs, xvar )
Local w_ivax:= 0, x, nTmp:= 0
Local w_exento:= 0, w_neto:= 0, w_totiva:= 0
Local aIvas:= {}, nItem, aItem
DEFAULT lTotalex:= .t.,;
nNivel := 0,;
xvar := 0,;
lPorArt := .t.
// ? lTotalex, LEN(ADATOS), lPorArt
if aDatos <> NIL .AND. LEN(aDatos) > 0
FOR EACH aItem IN aDatos
if ( lPorArt )
IF !EMPTY( aItem[ ID_CODART ])
if aItem[ ID_IVAART ] <> 0
w_totiva+= ROUND( (aItem[ID_IMPART]*aItem[ID_IVAART])/100, oApp:RedondeoGral ) // 2
endif
endif
else
IF !EMPTY( aItem[ ID_NOMART ])
if aItem[ ID_EXEART ] <> "S"
w_totiva+= ROUND( (aItem[ID_IMPART]*aItem[ID_IVAART])/100, oApp:RedondeoGral ) // 2
endif
endif
endif
NEXT
endif
if !( lTotalex )
if aDatos <> NIL .AND. LEN(aDatos) > 0
FOR EACH aItem IN aDatos
if ( lPorArt )
IF !EMPTY( aItem[ ID_CODART ])
if aItem[ ID_IVAART ] == 0
w_exento+= aItem[ID_IMPART]
else
if ASCAN( aIvas, aItem[ID_IVAART] ) == 0
AAdd( aIvas, aItem[ID_IVAART] )
endif
w_neto+= aItem[ID_IMPART]
endif
endif
else
IF !EMPTY( aItem[ ID_NOMART ])
if aItem[ ID_EXEART ] == "S"
w_exento+= aItem[ID_IMPART]
else
w_neto+= aItem[ID_IMPART]
if ASCAN( aIvas, aItem[ID_IVAART] ) == 0
AAdd( aIvas, aItem[ID_IVAART] )
endif
endif
endif
endif
NEXT
oLbx2:aArrayData[ oLbx2:nArrayAt,xneto ] := w_neto
oLbx2:aArrayData[ oLbx2:nArrayAt,xexento ]:= w_exento
oLbx2:aArrayData[ oLbx2:nArrayAt,xiva1 ] := 0.00
else
if aCliente[ID_IVA1] # 0.00
if ASCAN( aIvas, aCliente[ID_IVA1] ) == 0
AAdd( aIvas, aCliente[ID_IVA1] )
endif
endif
endif
else
if aCliente[ID_IVA1] <> 0.00
if ASCAN( aIvas, aCliente[ID_IVA1] ) == 0
AAdd( aIvas, aCliente[ID_IVA1] )
endif
endif
endif
if !( lTotalex )
nTmp:= oLbx2:aArrayData[ oLbx2:nArrayAt,xneto ]
if oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ] <> 0.00
x:= ROUND( (oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ]*100)/nTmp, 2 )
nTmp-= oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ]
if w_totiva <> 0
w_totiva-= ROUND( (w_totiva*x)/100, 2 )
endif
else
FOR x:= xdto1 TO xdto4
if oLbx2:aArrayData[ oLbx2:nArrayAt,x ] # 0.00
nTmp-= ROUND( (nTmp*oLbx2:aArrayData[ oLbx2:nArrayAt,x ])/100, 2 )
if w_totiva # 0
w_totiva-= ROUND( (w_totiva*oLbx2:aArrayData[ oLbx2:nArrayAt,x ])/100, 2 )
endif
endif
NEXT
endif
oLbx2:aArrayData[ oLbx2:nArrayAt,xsubtot ]:= nTmp
if aCliente[ ID_CLACOM ] == "A" .and. LEN(aIvas)>0
oLbx2:aArrayData[ oLbx2:nArrayAt,xiva1 ]:= w_totiva
endif
elseif xvar == xneto
nTmp:= oLbx2:aArrayData[ oLbx2:nArrayAt,xneto ]
if oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ] <> 0.00
x:= ROUND( (oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ]*100)/nTmp, 2 )
nTmp-= oLbx2:aArrayData[ oLbx2:nArrayAt,xdto5 ]
if w_totiva <> 0
w_totiva-= ROUND( (w_totiva*x)/100, 2 )
endif
else
FOR x:= xdto1 TO xdto4
if oLbx2:aArrayData[ oLbx2:nArrayAt,x ] <> 0.00
nTmp-= ROUND( (nTmp*oLbx2:aArrayData[ oLbx2:nArrayAt,x ])/100, 2 )
if w_totiva <> 0
w_totiva-= ROUND( (w_totiva*oLbx2:aArrayData[ oLbx2:nArrayAt,x ])/100, 2 )
endif
endif
NEXT
endif
oLbx2:aArrayData[ oLbx2:nArrayAt,xsubtot ]:= nTmp
endif
oLbx2:aArrayData[ oLbx2:nArrayAt,xtotal ]:= 0.00
FOR x:= xsubtot TO xtotal-1
oLbx2:aArrayData[ oLbx2:nArrayAt,xtotal ]+= oLbx2:aArrayData[ oLbx2:nArrayAt,x ]
NEXT
oLbx2:Gotop()
oLbx2:Refresh()
RETURN ( .t. )
*------------------------------------------------------------------------------------------
STATIC FUNCTION Valida( oGet, oCol, nId, oBrw, aCliente, cPathRs, nIdx, oLbx )
local oDbf, oTmp
local lRet:= .F., lSek:= .f., lNext:= .f., lFiltroRubro:= .t.
local cQuery, c3:= "", c2:= "", c4:= "", cMsg:= "", cQry, cScp
local uCod:= oGet:value()
local nIrA:= 0, n2, nX, xTmp, n3, n4, nPrecom, nCotiza:= 0.00
local aTmp[5]
if nId == 1
aCliente[ ID_ITEM ]:= {}
if !EMPTY( uCod )
// Busco el articulo por codigo ingresado
if (lRet:= LoadQX( oBrw, oLbx, "t1.codart = "+ClipValue2SQL(uCod)+" LIMIT 1", aCliente ))
uCod:= oBrw:aArrayData[ oBrw:nArrayAt, ID_CODART ]
lNext:= .T.
endif
endif
elseif nId == 2
If ( uCod $ "13CcUu" )
if uCod == "1"
uCod := "U"
elseif uCod == "3"
uCod:= "C"
else
uCod:= UPPER(uCod)
endif
lRet:= .t.
else
MsgStop("Debe especificar la unidad de venta.","Error." )
EndIf
elseif nId == 3 // Bonificaciones.
if uCod >= 0.00
AFill( aTmp, 0.00 )
FOR nX:= 1 TO LEN( aTmp )
aTmp[ nX ]:= oBrw:aArrayData[ oBrw:nArrayAt, nX+(ID_BONIF1-1) ]
NEXT
aTmp[ nIdx ]:= uCod
n2:= oBrw:aArrayData[ oBrw:nArrayAt, ID_COSART ]
FOR nX:= 1 TO LEN(aTmp)
if aTmp[nX] <> 0.00
n3:= ROUND( ( 100-aTmp[nX] ) / 100, 4 )
n2:= ROUND( n2*n3, 2 )
endif
NEXT
oBrw:aArrayData[ oBrw:nArrayAt, ID_PREART ]:= n2
oBrw:aArrayData[ oBrw:nArrayAt, ID_IMPART ]:= ROUND(oBrw:aArrayData[ oBrw:nArrayAt, ID_CANART ]*oBrw:aArrayData[ oBrw:nArrayAt, ID_PREART ],2 )
lRet:= .t.
endif
elseif nId == 4 // Precio.
if uCod >= 0.00
AFill( aTmp, 0.00 )
FOR nX:= 1 TO LEN( aTmp )
aTmp[ nX ]:= oBrw:aArrayData[ oBrw:nArrayAt, nX+(ID_BONIF1-1) ]
NEXT
n2:= uCod
FOR nX:= 1 TO LEN(aTmp)
if aTmp[nX] <> 0.00
n3:= ROUND( ( 100-aTmp[nX] ) / 100, 4 )
n2:= ROUND( n2*n3, 2 )
endif
NEXT
oBrw:aArrayData[ oBrw:nArrayAt, ID_PREART ]:= n2
oBrw:aArrayData[ oBrw:nArrayAt, ID_IMPART ]:= ROUND(oBrw:aArrayData[ oBrw:nArrayAt, ID_CANART ]*n2,2 )
lRet:= .t.
endif
endif
if ( lRet )
oGet:VarPut( uCod )
oCol:PostEdit()
if ( lNext )
oBrw:SelectCol(04)
else
if nIdx <> NIL .and. uCod == 0.00
if LEN(oBrw:aArrayData) == oBrw:nArrayAt
NewReg(oBrw, aCliente, .t. )
oBrw:GoBottom()
oBrw:SelectCol(02)
endif
endif
endif
oBrw:Refresh()
endif
return lRet