def create
@ordr = Ordr.find(:first,:order => "DocEntry DESC")
if @ordr.nil?
@tmp=0
else
@tmp=@ordr.id
end
@ordr = Ordr.new(params[:ordr])
@ordr.id=@tmp+1
@ordr.DocNum=@ordr.id
@rdr1 = Rdr1.new(params[:rdr1])
@rdr1.DocEntry =@tmp+1
@rdr1.LineNum=0
respond_to do |format|
if @ordr.save and @rdr1.save
format.html { redirect_to(@ordr, :notice => 'Ordr was successfully created.') }
format.xml { render :xml => @ordr, :status => :created, :location => @ordr }
else
format.html { render :action => "new" }
format.xml { render :xml => @ordr.errors, :status => :unprocessable_entity }
end
end
end