let's first put RBG;RBG;RBG in all three boxes to get rid from color constraint
now we are left with "RR BBB GGGG" many balls (aka,2Red ,3Black,4Green balls) and we have to put 3 balls in each box to fulfill second constraint of 6 balls in each boxes.
now,in first box we can put 3 balls in 9 ways as : $(i) RBG (ii)RRB (iii)RBB (iv)BBB (v)GGG (vi)RRG (vii)RGG (viii)GBB (ix)BGG $ after putting three balls in 1st box we still have 6 balls left to distribute into 2nd and 3rd boxes respectively
now, for each of 9 above ways we'll again distribute 3 balls in to the second box and the rest balls automatically go to 3rd box in 1 way
so let's count
for (i) way i.e, RBG in 1st box we are left with R BB GGG balls which can be put in 2nd box in 6 ways (i.e,RBB,RGG,RBG,GGG,BBG,GGB)
for (ii) way i.e,RRB in 1st box we are left with BB GGGG balls which can be put in 2nd box in 3 ways (i.e,GGG,BBG,GGB)
for (iii) way i.e,RBB in 1st box we are left with R B GGGG balls which can be put in 2nd box in 4 ways (i.e,GGG,GGR,GGB,GBR)
for (iv) way i.e,BBB in 1st box we are left with RR GGGG balls which can be put in 2nd box in 3 ways (i.e,GGG,GGR,GRR)
for (v) way i.e,GGG in 1st box we are left with RR BBB G balls which can be put in 2nd box in 6 ways (i.e,GBB,GRR,RBB,RBG,BRR,BBB)
for (vi) way i.e,RRG in 1st box we are left with BBB GGG balls which can be put in 2nd box in 4 ways (i.e,BBB,GBB,GGG,GGB)
for (vii) way i.e,RGG in 1st box we are left with R BBB GG balls which can be put in 2nd box in 6 ways (i.e,RBG,RGG,RBB,GGB,BBG,BBB)
for (viii) way i.e,GBB in 1st box we are left with RR B GGG balls which can be put in 2nd box in 6 ways (i.e,BGG,BRR,RBG,RRG,GGG,GGR)
for (ix) way i.e,BGG in 1st box we are left with RR BB GG balls which can be put in 2nd box in 7 ways (i.e,GBB,RBB,BRR,GRR,RGG,BGG,RBG)
so answer should be=sum of all above ways=(6+3+4+3+6+4+6+6+7)=45 ways