xm?=?arr(j,?2)
If?CDate(dt)?-?CDate(arr(j,?4))?=?0?Then
If?Not?d.exists(xm)?Then
Set?rng?=?Union(rng,?Sheets("每天入單").Range("A"?&?j)) ReDim?brr(1?To?14) brr(1)?=?arr(j,?2) brr(2)?=?arr(j,?1) brr(3)?=?arr(j,?4)Else
brr?=?d(xm)End?If
If?arr(j,?5)?=?"折扣"?Then
brr(8)?=?brr(8)?+?arr(j,?13) brr(5)?=?brr(5)?+?arr(j,?12) brr(6)?=?brr(6)?+?arr(j,?13) brr(7)?=?brr(7)?+?arr(j,?14) d(xm)?=?brrEnd?If
End?If
Next End?With t?=?d.items Sheets("當天匯總").Activate Sheets("當天匯總").UsedRange.Offset(2,?0).Clear Sheets("當天匯總").Range("a2").Resize(d.Count,?UBound(brr))?=?Application.Transpose(Application.Transpose(t)) For?Each?c?In?Range("a2").Resize(d.Count,?1) c.Offset(,?0).Resize(1,?7)?=?d(c.Value) Next hs?=?[a65536].End(xlUp).Row For?hk?=?2?To?hs Cells(hk,?6)?=?Cells(hk,?6)?-?Cells(hk,?8) Cells(hk,?9)?=?Cells(hk,?5)?-?Cells(hk,?6)?-?Cells(hk,?7) Next Range("a1").CurrentRegion.Borders.LineStyle?=?xlContinuousEnd?Sub