rep order edit logic