help with please - Ayuda por favor

This forum is for general support of Xbase++
Post Reply
Message
Author
User avatar
Jose Marte2
Posts: 45
Joined: Thu Nov 16, 2017 2:19 pm
Location: República Dominicana

help with please - Ayuda por favor

#1 Post by Jose Marte2 »

Greetings to all I hope you are well as well as your families

Friends, I need your help.

I have in my billing program, in the image that I attached I need to see how you can add the quantities of the items that
codes are the same, that is, they are repeated in the array

thanks in advance

A sample I have the arrangement

FOR J=1 To Len(aArreglo)
cCodArt := aArreglo[J][1]
cDesArt := aArreglo[J][2]
nCantid := aArreglo[J][3]
NEXT

Saludos para todos espero que esten bien al igual que sus familias

Amigos, necesito de su ayuda

tengo en mi programa de facturación, en la imagen que le adjunto necesito ver como puede sumar las cantidades de los articulos que los
códigos sean iguales es decir que están repetido en el arreglo

las gracias anticipadas

Una Muestra tengo el arreglo

FOR J=1 To Len(aArreglo)
cCodArt := aArreglo[J][1]
cDesArt := aArreglo[J][2]
nCantid := aArreglo[J][3]
NEXT
Attachments
Sin título.jpg
Sin título.jpg (454.19 KiB) Viewed 2072 times
José Marte
Software & Servicios


Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: help with please - Ayuda por favor

#2 Post by Wolfgang Ciriack »

Hello Jose,
make a new array for display:

Code: Select all

FOR J=1 To Len(aArreglo)
   if (p := AScan(aNew, {|a| a[1] == aArreglo[J][1]}) == 0
      ** not in aNew
      AAdd(aNew, aArreglo[J])
   else
      ** add quantity to existing item
      aNew[p][3] += aArreglo[J][3]
   endif
NEXT
Then display aNew.
_______________________
Best Regards
Wolfgang

Post Reply