diff --git a/android/app/src/main/assets/litter.scm b/android/app/src/main/assets/litter.scm new file mode 100644 index 0000000..cb2dc21 --- /dev/null +++ b/android/app/src/main/assets/litter.scm @@ -0,0 +1,41 @@ +;; Mongoose 2000 Copyright (C) 2018 FoAM Kernow +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU Affero General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU Affero General Public License for more details. +;; +;; You should have received a copy of the GNU Affero General Public License +;; along with this program. If not, see . + +(define (init-litter) + ;; retreve (and increment) the pack's id info + (set-current! 'entity-type "pack") + (let ((letter (entity-get-value "litter-code-letter")) + (number (entity-get-value "litter-code-number")) + (parent (entity-get-value "unique_id"))) + (let ((name (cond + ((or (not letter) (not number)) "No ID") + (else + (entity-set-value! "litter-code-number" "int" (+ number 1)) + (entity-update-values!) ;; hmm, cancel won't work + (set-current! 'pack (es-ktv-list)) ;; need to remove this pack stuff... + (string-append letter (number->string number)))))) + (list + (ktv "name" "varchar" name) + (ktv "parent" "varchar" parent) + (ktv "date" "varchar" (date->string (date-time))))))) + +(define (db-current-litter) + (db-filter + db "sync" "litter" + (list + (list "pack-id" "varchar" "=" (ktv-get (get-current 'pack '()) "unique_id")) + (list "dob" "varchar" "d<" 30)))) + + diff --git a/android/app/src/main/java/foam/starwisp/UpdateLitterActivity.java b/android/app/src/main/java/foam/starwisp/UpdateLitterActivity.java new file mode 100644 index 0000000..fd567f3 --- /dev/null +++ b/android/app/src/main/java/foam/starwisp/UpdateLitterActivity.java @@ -0,0 +1,30 @@ +// Starwisp Copyright (C) 2013 Dave Griffiths +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package foam.starwisp; + +import android.app.Activity; +import android.os.Bundle; +import android.content.Context; + +public class UpdateLitterActivity extends foam.starwisp.StarwispActivity +{ + @Override + public void onCreate(Bundle savedInstanceState) + { + m_Name = "update-litter"; + super.onCreate(savedInstanceState); + } +}