 --
 
 CREATE FUNCTION fn_get_max_mos(v_program integer, v_facility integer, v_product character varying) RETURNS integer
-LANGUAGE plpgsql
-AS $$
+    LANGUAGE plpgsql
+    AS $$
 DECLARE
 
   v_ret integer;
   v_programproductid integer;
   v_facilitytypeid integer;
   v_productid integer;
-
+     
 BEGIN
-  select id into v_productid from products where code =  v_product;
-  v_programproductid := fn_get_program_product_id(v_program, v_productid);
-  select typeid into v_facilitytypeid from facilities where id =  v_facility;
-
-  select maxmonthsofstock into v_ret from facility_approved_products where programproductid = v_programproductid and facilitytypeid = v_facilitytypeid;
-
-  return v_ret;
-
+   select id into v_productid from products where code =  v_product;
+   v_programproductid := fn_get_program_product_id(v_program, v_productid);
+   select typeid into v_facilitytypeid from facilities where id =  v_facility;
+
+   select maxmonthsofstock into v_ret from facility_approved_products where programproductid = v_programproductid and facilitytypeid = v_facilitytypeid;
+
+   return v_ret;       
+ 
 END;
 $$;
 

--

CREATE SEQUENCE order_quantity_adjustment_products_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


ALTER TABLE order_quantity_adjustment_products_id_seq OWNER TO postgres;

--

ALTER TABLE ONLY vaccine_report_logistics_line_items
    ADD CONSTRAINT vaccine_report_logistics_line_items_reportid_fkey FOREIGN KEY (reportid) REFERENCES vaccine_reports(id);


--
