listOfInvoiceGrandTotals) {
64 | this.listOfInvoiceGrandTotals = listOfInvoiceGrandTotals;
65 | }
66 |
67 | public double calcSumResult() {
68 |
69 | double invoiceGrandTotal = 0;
70 | double sum = 0;
71 | for (String amount:listOfInvoiceGrandTotals) {
72 |
73 | try {
74 | invoiceGrandTotal = Double.parseDouble(amount);
75 | } catch (Exception e) {
76 | invoiceGrandTotal = 0;
77 | }
78 |
79 | sum += invoiceGrandTotal;
80 | }
81 |
82 |
83 | return sum;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/zxing/IntentResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 ZXing authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | package com.stockita.stockitapointofsales.zxing;
19 |
20 | /**
21 | * Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.
22 | *
23 | * @author Sean Owen
24 | */
25 | public class IntentResult {
26 |
27 | private final String contents;
28 | private final String formatName;
29 | private final byte[] rawBytes;
30 | private final Integer orientation;
31 | private final String errorCorrectionLevel;
32 |
33 | IntentResult() {
34 | this(null, null, null, null, null);
35 | }
36 |
37 | IntentResult(String contents,
38 | String formatName,
39 | byte[] rawBytes,
40 | Integer orientation,
41 | String errorCorrectionLevel) {
42 | this.contents = contents;
43 | this.formatName = formatName;
44 | this.rawBytes = rawBytes;
45 | this.orientation = orientation;
46 | this.errorCorrectionLevel = errorCorrectionLevel;
47 | }
48 |
49 | /**
50 | * @return raw content of barcode
51 | */
52 | public String getContents() {
53 | return contents;
54 | }
55 |
56 | /**
57 | * @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
58 | */
59 | public String getFormatName() {
60 | return formatName;
61 | }
62 |
63 | /**
64 | * @return raw bytes of the barcode content, if applicable, or null otherwise
65 | */
66 | public byte[] getRawBytes() {
67 | return rawBytes;
68 | }
69 |
70 | /**
71 | * @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
72 | */
73 | public Integer getOrientation() {
74 | return orientation;
75 | }
76 |
77 | /**
78 | * @return name of the error correction level used in the barcode, if applicable
79 | */
80 | public String getErrorCorrectionLevel() {
81 | return errorCorrectionLevel;
82 | }
83 |
84 | @Override
85 | public String toString() {
86 | int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
87 | return "Format: " + formatName + '\n' +
88 | "Contents: " + contents + '\n' +
89 | "Raw bytes: (" + rawBytesLength + " bytes)\n" +
90 | "Orientation: " + orientation + '\n' +
91 | "EC level: " + errorCorrectionLevel + '\n';
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_payment.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
34 |
35 |
39 |
40 |
41 |
45 |
46 |
47 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_paid_sales_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
35 |
36 |
40 |
41 |
42 |
46 |
47 |
48 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/data/ItemImageModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.data;
26 |
27 | import android.os.Parcel;
28 | import android.os.Parcelable;
29 |
30 | /**
31 | * This is the model class for item images
32 | */
33 | public class ItemImageModel implements Parcelable {
34 |
35 | //State
36 | private String imageUrl;
37 | private String itemPushKey;
38 |
39 |
40 | /**
41 | * Empty constructor
42 | */
43 | public ItemImageModel() {
44 |
45 | }
46 |
47 | /**
48 | * Constructor
49 | * @param imageUrl The url for this image or the file name
50 | * @param itemPushKey The push key of an item master created by Server
51 | */
52 | public ItemImageModel(String imageUrl, String itemPushKey){
53 |
54 | this.imageUrl = imageUrl;
55 | this.itemPushKey = itemPushKey;
56 |
57 | }
58 |
59 |
60 | public String getImageUrl() {
61 | return imageUrl;
62 | }
63 |
64 | public void setImageUrl(String imageUrl) {
65 | this.imageUrl = imageUrl;
66 | }
67 |
68 | public String getItemPushKey() {
69 | return itemPushKey;
70 | }
71 |
72 | public void setItemPushKey(String itemPushKey) {
73 | this.itemPushKey = itemPushKey;
74 | }
75 |
76 | protected ItemImageModel(Parcel in) {
77 | imageUrl = in.readString();
78 | itemPushKey = in.readString();
79 | }
80 |
81 | @Override
82 | public int describeContents() {
83 | return 0;
84 | }
85 |
86 | @Override
87 | public void writeToParcel(Parcel dest, int flags) {
88 | dest.writeString(imageUrl);
89 | dest.writeString(itemPushKey);
90 | }
91 |
92 | @SuppressWarnings("unused")
93 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
94 | @Override
95 | public ItemImageModel createFromParcel(Parcel in) {
96 | return new ItemImageModel(in);
97 | }
98 |
99 | @Override
100 | public ItemImageModel[] newArray(int size) {
101 | return new ItemImageModel[size];
102 | }
103 | };
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_item_lookup.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
33 |
34 |
38 |
39 |
43 |
44 |
45 |
46 |
49 |
50 |
56 |
57 |
64 |
65 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_open_sales_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
35 |
36 |
40 |
41 |
42 |
46 |
47 |
48 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
68 |
69 |
70 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
26 |
33 |
34 |
38 |
39 |
43 |
44 |
51 |
52 |
53 |
54 |
55 |
56 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_users_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
33 |
34 |
38 |
39 |
40 |
48 |
49 |
56 |
57 |
58 |
59 |
60 |
66 |
67 |
68 |
75 |
76 |
83 |
84 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/customViews/AdapterViewMiniLookupItemList.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.customViews;
26 |
27 | import android.content.Context;
28 | import android.util.AttributeSet;
29 | import android.view.View;
30 | import android.widget.LinearLayout;
31 | import android.widget.TextView;
32 |
33 | import com.stockita.stockitapointofsales.R;
34 |
35 | /**
36 | * This class is a custom view for the mini lookup item list card
37 | */
38 | public class AdapterViewMiniLookupItemList extends LinearLayout {
39 |
40 | // Member variables
41 | private LinearLayout mRoot;
42 | private TextView mItemNumberLookup, mItemDescLookup, mItemPriceLookup;
43 |
44 | /**
45 | * Constructor
46 | * @param context
47 | */
48 | public AdapterViewMiniLookupItemList(Context context) {
49 | super(context);
50 | init(context);
51 | }
52 |
53 | /**
54 | * Constructor
55 | * @param context
56 | * @param attrs
57 | */
58 | public AdapterViewMiniLookupItemList(Context context, AttributeSet attrs) {
59 | super(context, attrs);
60 | init(context);
61 | }
62 |
63 | /**
64 | * Helper method to initialize the view group and the widget
65 | * @param context Activity context
66 | */
67 | private void init(Context context) {
68 |
69 |
70 | // Initialize the layout file which is the root view of all widgets
71 | View mRootView = inflate(context, R.layout.adapter_view_mini_lookup, this);
72 |
73 | // Initialize the view group and widgets
74 | mRoot = (LinearLayout) mRootView.findViewById(R.id.root);
75 | mItemNumberLookup = (TextView) mRootView.findViewById(R.id.item_number_lookup);
76 | mItemDescLookup = (TextView) mRootView.findViewById(R.id.item_desc_lookup);
77 | mItemPriceLookup = (TextView) mRootView.findViewById(R.id.item_price_lookup);
78 |
79 | }
80 |
81 | public LinearLayout getmRoot() {
82 | return mRoot;
83 | }
84 |
85 | public void setmRoot(LinearLayout mRoot) {
86 | this.mRoot = mRoot;
87 | }
88 |
89 | public TextView getmItemNumberLookup() {
90 | return mItemNumberLookup;
91 | }
92 |
93 | public void setmItemNumberLookup(TextView mItemNumberLookup) {
94 | this.mItemNumberLookup = mItemNumberLookup;
95 | }
96 |
97 | public TextView getmItemDescLookup() {
98 | return mItemDescLookup;
99 | }
100 |
101 | public void setmItemDescLookup(TextView mItemDescLookup) {
102 | this.mItemDescLookup = mItemDescLookup;
103 | }
104 |
105 | public TextView getmItemPriceLookup() {
106 | return mItemPriceLookup;
107 | }
108 |
109 | public void setmItemPriceLookup(TextView mItemPriceLookup) {
110 | this.mItemPriceLookup = mItemPriceLookup;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
35 |
36 |
40 |
41 |
42 |
46 |
47 |
48 |
55 |
56 |
57 |
58 |
59 |
60 |
66 |
67 |
68 |
69 |
78 |
79 |
80 |
81 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_item_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
33 |
34 |
38 |
39 |
43 |
44 |
45 |
46 |
49 |
50 |
51 |
52 |
58 |
59 |
60 |
67 |
68 |
76 |
77 |
78 |
79 |
80 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/data/ItemModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.data;
26 |
27 | import android.os.Parcel;
28 | import android.os.Parcelable;
29 |
30 | /**
31 | * This is the model class for the Item Master
32 | */
33 | public class ItemModel implements Parcelable {
34 |
35 | // State
36 | private String itemNumber;
37 | private String itemDesc;
38 | private String unitOfMeasure;
39 | private String itemPrice;
40 |
41 |
42 | /**
43 | * Empty constructor
44 | */
45 | public ItemModel() {
46 |
47 | }
48 |
49 | /**
50 | * Constructor
51 | * @param itemNumber The item number from the barcode but this is not the one generated by Server
52 | * @param itemDesc The name and the spec for this item
53 | * @param unitOfMeasure Unit of measure
54 | * @param itemPrice Selling price
55 | */
56 | public ItemModel(String itemNumber, String itemDesc, String unitOfMeasure, String itemPrice) {
57 |
58 | this.itemNumber = itemNumber;
59 | this.itemDesc = itemDesc;
60 | this.unitOfMeasure = unitOfMeasure;
61 | this.itemPrice = itemPrice;
62 |
63 | }
64 |
65 | public String getItemNumber() {
66 | return itemNumber;
67 | }
68 |
69 | public void setItemNumber(String itemNumber) {
70 | this.itemNumber = itemNumber;
71 | }
72 |
73 | public String getItemDesc() {
74 | return itemDesc;
75 | }
76 |
77 | public void setItemDesc(String itemDesc) {
78 | this.itemDesc = itemDesc;
79 | }
80 |
81 | public String getUnitOfMeasure() {
82 | return unitOfMeasure;
83 | }
84 |
85 | public void setUnitOfMeasure(String unitOfMeasure) {
86 | this.unitOfMeasure = unitOfMeasure;
87 | }
88 |
89 | public String getItemPrice() {
90 | return itemPrice;
91 | }
92 |
93 | public void setItemPrice(String itemPrice) {
94 | this.itemPrice = itemPrice;
95 | }
96 |
97 | protected ItemModel(Parcel in) {
98 | itemNumber = in.readString();
99 | itemDesc = in.readString();
100 | unitOfMeasure = in.readString();
101 | itemPrice = in.readString();
102 | }
103 |
104 | @Override
105 | public int describeContents() {
106 | return 0;
107 | }
108 |
109 | @Override
110 | public void writeToParcel(Parcel dest, int flags) {
111 | dest.writeString(itemNumber);
112 | dest.writeString(itemDesc);
113 | dest.writeString(unitOfMeasure);
114 | dest.writeString(itemPrice);
115 | }
116 |
117 | @SuppressWarnings("unused")
118 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
119 | @Override
120 | public ItemModel createFromParcel(Parcel in) {
121 | return new ItemModel(in);
122 | }
123 |
124 | @Override
125 | public ItemModel[] newArray(int size) {
126 | return new ItemModel[size];
127 | }
128 | };
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/customViews/ActivityViewMainActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.customViews;
26 |
27 | import android.content.Context;
28 | import android.support.design.widget.CoordinatorLayout;
29 | import android.support.design.widget.FloatingActionButton;
30 | import android.support.design.widget.TabLayout;
31 | import android.support.v4.view.ViewPager;
32 | import android.support.v7.widget.Toolbar;
33 | import android.util.AttributeSet;
34 | import android.view.View;
35 | import android.widget.TextView;
36 |
37 | import com.stockita.stockitapointofsales.R;
38 |
39 | /**
40 | * This class is a custom view for the {@link com.stockita.stockitapointofsales.activities.MainActivity}.
41 | */
42 | public class ActivityViewMainActivity extends CoordinatorLayout {
43 |
44 | // Views
45 | private Toolbar mToolbar;
46 | private TabLayout mTabs;
47 | private ViewPager mViewPagerContainer;
48 | private FloatingActionButton mFab;
49 |
50 | /**
51 | * Constructor
52 | * @param context Activity context
53 | */
54 | public ActivityViewMainActivity(Context context) {
55 | super(context);
56 | init(context);
57 | }
58 |
59 | /**
60 | * Constructor
61 | * @param context Activity context
62 | * @param attrs {@link AttributeSet}
63 | */
64 | public ActivityViewMainActivity(Context context, AttributeSet attrs) {
65 | super(context, attrs);
66 | init(context);
67 | }
68 |
69 | /**
70 | * Helper method to initialize the view group and the widget
71 | * @param context Activity context
72 | */
73 | private void init(Context context) {
74 |
75 |
76 | // Initialize the layout file which is the root view of all widgets
77 | View mRootView = inflate(context, R.layout.view_activity_main, this);
78 |
79 | // Initialize the widgets
80 | mToolbar = (Toolbar) mRootView.findViewById(R.id.toolbar);
81 | mTabs = (TabLayout) mRootView.findViewById(R.id.tabs);
82 | mViewPagerContainer = (ViewPager) mRootView.findViewById(R.id.container);
83 | mFab = (FloatingActionButton) mRootView.findViewById(R.id.fab);
84 |
85 | }
86 |
87 | public Toolbar getmToolbar() {
88 | return mToolbar;
89 | }
90 |
91 | public void setmToolbar(Toolbar mToolbar) {
92 | this.mToolbar = mToolbar;
93 | }
94 |
95 | public TabLayout getmTabs() {
96 | return mTabs;
97 | }
98 |
99 | public void setmTabs(TabLayout mTabs) {
100 | this.mTabs = mTabs;
101 | }
102 |
103 | public ViewPager getmViewPagerContainer() {
104 | return mViewPagerContainer;
105 | }
106 |
107 | public void setmViewPagerContainer(ViewPager mViewPagerContainer) {
108 | this.mViewPagerContainer = mViewPagerContainer;
109 | }
110 |
111 | public FloatingActionButton getmFab() {
112 | return mFab;
113 | }
114 |
115 | public void setmFab(FloatingActionButton mFab) {
116 | this.mFab = mFab;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
27 |
30 | />
31 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
52 |
53 |
54 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
72 |
73 |
76 |
79 |
82 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/utilities/Constants.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.utilities;
26 |
27 | /**
28 | * This class is where we store the constants
29 | */
30 | public final class Constants {
31 |
32 | // Firebase locations
33 | public static final String FIREBASE_USER_LOCATION = "users";
34 | public static final String FIREBASE_USER_LOG_LOCATION = "usersLog";
35 | public static final String FIREBASE_ITEM_MASTER_LOCATION = "itemMaster";
36 | public static final String FIREBASE_ITEM_MASTER_IMAGE_LOCATION = "itemImage";
37 | public static final String FIREBASE_TRIGGER_LOCATION = "trigger";
38 | public static final String FIREBASE_SALES_DETAIL_PENDING_LOCATION = "salesDetailPending";
39 | public static final String FIREBASE_PAID_SALES_HEADER_LOCATION = "paidSalesHeader";
40 | public static final String FIREBASE_PAID_SALES_DETAIL_LOCATION = "paidSalesDetail";
41 | public static final String FIREBASE_PAYMENT_LOCATION = "payment";
42 | public static final String FIREBASE_OPEN_SALES_HEADER_LOCATION = "openSalesHeader";
43 | public static final String FIREBASE_OPEN_SALES_DETAIL_LOCATION = "openSalesDetail";
44 | public static final String FIREBASE_ARCHIVE_SALES_HEADER_LOCATION = "archiveSalesHeader";
45 | public static final String FIREBASE_ARCHIVE_SALES_DETAIL_LOCATION = "archiveSalesDetail";
46 | public static final String FIREBASE_ARCHIVE_PAYMENT_LOCATION = "archivePayment";
47 | public static final String FIREBASE_YEAR_MONTH_LOCATION = "yearMonth";
48 |
49 |
50 | // Firebase property
51 | public static final String FIREBASE_PROPERTY_TIMESTAMP = "timestamp";
52 | public static final String FIREBASE_PROPERTY_USERS_STATUS = "status";
53 | public static final String FIREBASE_PROPERTY_CONNECTION_STATUS = "connectionsStatus";
54 | public static final String FIREBASE_PROPERTY_LAST_ONLINE = "lastOnline";
55 | public static final String FIREBASE_PROPERTY_IMAGE_URL = "imageUrl";
56 | public static final String FIREBASE_PROPERTY_TOTAL_AMOUNT = "totalAmount";
57 |
58 |
59 | // Local storage SharedPreferences common data
60 | public static final String COMMON_DATA_SHARED_PREFERENCES = "COMMON_DATA_SHARED_PREFERENCES";
61 |
62 | // Key local storage SharedPreferences data
63 | public static final String KEY_USERS_EMAIL = "KEY_USERS_EMAIL";
64 | public static final String KEY_USERS_NAME = "KEY_USERS_NAME";
65 | public static final String KEY_USERS_UID = "KEY_USERS_UID";
66 | public static final String KEY_USER_PHOTO = "KEY_USER_PHOTO";
67 |
68 |
69 | // ItemMasterAddEditCallbacks Interface request code
70 | public static final int REQUEST_CODE_DIALOG_ONE = 1;
71 | public static final int REQUEST_CODE_DIALOG_TWO = 2;
72 | public static final int REQUEST_CODE_DIALOG_THREE = 3;
73 |
74 |
75 | // SalesDetailCallbacks
76 | public static final int REQUEST_CODE_SALES_DIALOG_ONE = 1;
77 | public static final int REQUEST_CODE_SALES_DIALOG_TWO = 2;
78 |
79 | // SalesPendingAddFormDialogFragment
80 | public static final int REQUEST_CODE_SALES_ADD_ITEM_LOOPUP = 1;
81 |
82 | // OpenSalesAddFormDialogFragment
83 | public static final int REQUEST_CODE_OPEN_SALES_ADD_ITEM_LOOKUP = 2;
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/utilities/ManageDateTime.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.utilities;
26 |
27 | import java.text.DateFormat;
28 | import java.text.SimpleDateFormat;
29 | import java.util.Calendar;
30 |
31 | /**
32 | * Helper class to convert time in millis to other form or format
33 | */
34 | public class ManageDateTime {
35 |
36 | // State
37 | private long currentTimeMillis;
38 | private long givenTimeMillis;
39 |
40 | /**
41 | * Constructor
42 | * @param timestamp any time in long millis
43 | */
44 | public ManageDateTime(long timestamp) {
45 | this.givenTimeMillis = timestamp;
46 | }
47 |
48 | public long getCurrentTimeMillis() {
49 | return currentTimeMillis;
50 | }
51 |
52 | public void setCurrentTimeMillis(long currentTimeMillis) {
53 | this.currentTimeMillis = currentTimeMillis;
54 | }
55 |
56 | public long getGivenTimeMillis() {
57 | return givenTimeMillis;
58 | }
59 |
60 | public void setGivenTimeMillis(long givenTimeMillis) {
61 | this.givenTimeMillis = givenTimeMillis;
62 | }
63 |
64 |
65 | /**
66 | * This will convert from long millis to int year
67 | * @return year in type int.
68 | */
69 | public int getGivenTimeMillisYear() {
70 | Calendar calendar = Calendar.getInstance();
71 | calendar.setTimeInMillis(givenTimeMillis);
72 |
73 | return calendar.get(Calendar.YEAR);
74 | }
75 |
76 |
77 | /**
78 | * This method will convert from long millis to int month
79 | * @return month in type int.
80 | */
81 | public int getGivenTimeMillisMonth() {
82 | Calendar calendar = Calendar.getInstance();
83 | calendar.setTimeInMillis(givenTimeMillis);
84 |
85 | return calendar.get(Calendar.MONTH);
86 | }
87 |
88 |
89 | /**
90 | * This method will convert from long millis to int day
91 | * @return day in type int.
92 | */
93 | public int getGivenTimeMillisDay() {
94 | Calendar calendar = Calendar.getInstance();
95 | calendar.setTimeInMillis(givenTimeMillis);
96 |
97 | return calendar.get(Calendar.DAY_OF_MONTH);
98 | }
99 |
100 | /**
101 | * Get the full formated date and time in string
102 | * @return full formated date and time
103 | */
104 | public String getGivenTimeMillisInDateFormat() {
105 | Calendar calendar = Calendar.getInstance();
106 | calendar.setTimeInMillis(givenTimeMillis);
107 |
108 | DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a");
109 |
110 | return dateFormat.format(calendar.getTime());
111 | }
112 |
113 |
114 | /**
115 | * Get the year and month format
116 | * @return year and month in string
117 | */
118 | public String getGivenTimeMillisInYearMonth() {
119 | Calendar calendar = Calendar.getInstance();
120 | calendar.setTimeInMillis(givenTimeMillis);
121 |
122 | DateFormat dateFormat = new SimpleDateFormat("yyyyMM");
123 |
124 | return dateFormat.format(calendar.getTime());
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/customViews/AdapterViewItemLookup.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.customViews;
26 |
27 | import android.content.Context;
28 | import android.support.v7.widget.RecyclerView;
29 | import android.util.AttributeSet;
30 | import android.view.View;
31 | import android.widget.FrameLayout;
32 | import android.widget.LinearLayout;
33 | import android.widget.TextView;
34 |
35 | import com.stockita.stockitapointofsales.R;
36 |
37 | /**
38 | * This class is a custom view for each element in the item master lookup
39 | */
40 | public class AdapterViewItemLookup extends LinearLayout {
41 |
42 |
43 | // Members variables
44 | private LinearLayout mRoot, mSubTextDetail;
45 | private FrameLayout mImageFrame;
46 | private TextView mItemDesc, mItemPrice;
47 | private RecyclerView mItemImage;
48 |
49 |
50 | public AdapterViewItemLookup(Context context) {
51 | super(context);
52 | init(context);
53 | }
54 |
55 | public AdapterViewItemLookup(Context context, AttributeSet attrs) {
56 | super(context, attrs);
57 | init(context);
58 | }
59 |
60 | /**
61 | * Helper method to initialize the view group and the widget
62 | * @param context Activity context
63 | */
64 | private void init(Context context) {
65 |
66 |
67 | // Initialize the layout file which is the root view of all widgets
68 | View mRootView = inflate(context, R.layout.adapter_view_item_lookup, this);
69 |
70 | // Initialize the view group and widgets
71 | mRoot = (LinearLayout) mRootView.findViewById(R.id.root);
72 | mImageFrame = (FrameLayout) mRootView.findViewById(R.id.image_frame);
73 | mItemImage = (RecyclerView) mRootView.findViewById(R.id.item_image);
74 | mSubTextDetail = (LinearLayout) mRootView.findViewById(R.id.sub_text_detail);
75 | mItemDesc = (TextView) mRootView.findViewById(R.id.item_desc);
76 | mItemPrice = (TextView) mRootView.findViewById(R.id.item_price);
77 |
78 | }
79 |
80 | public LinearLayout getmRoot() {
81 | return mRoot;
82 | }
83 |
84 | public void setmRoot(LinearLayout mRoot) {
85 | this.mRoot = mRoot;
86 | }
87 |
88 | public LinearLayout getmSubTextDetail() {
89 | return mSubTextDetail;
90 | }
91 |
92 | public void setmSubTextDetail(LinearLayout mSubTextDetail) {
93 | this.mSubTextDetail = mSubTextDetail;
94 | }
95 |
96 | public FrameLayout getmImageFrame() {
97 | return mImageFrame;
98 | }
99 |
100 | public void setmImageFrame(FrameLayout mImageFrame) {
101 | this.mImageFrame = mImageFrame;
102 | }
103 |
104 | public TextView getmItemDesc() {
105 | return mItemDesc;
106 | }
107 |
108 | public void setmItemDesc(TextView mItemDesc) {
109 | this.mItemDesc = mItemDesc;
110 | }
111 |
112 | public TextView getmItemPrice() {
113 | return mItemPrice;
114 | }
115 |
116 | public void setmItemPrice(TextView mItemPrice) {
117 | this.mItemPrice = mItemPrice;
118 | }
119 |
120 | public RecyclerView getmItemImage() {
121 | return mItemImage;
122 | }
123 |
124 | public void setmItemImage(RecyclerView mItemImage) {
125 | this.mItemImage = mItemImage;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_sales_header_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
32 |
33 |
37 |
38 |
49 |
50 |
63 |
64 |
65 |
66 |
70 |
71 |
82 |
83 |
84 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/customViews/AdapterViewPayment.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.customViews;
26 |
27 | import android.content.Context;
28 | import android.util.AttributeSet;
29 | import android.view.View;
30 | import android.widget.LinearLayout;
31 | import android.widget.TextView;
32 |
33 | import com.stockita.stockitapointofsales.R;
34 |
35 | /**
36 | * Custom view for the payment
37 | */
38 | public class AdapterViewPayment extends LinearLayout {
39 |
40 | private LinearLayout mRoot;
41 | private TextView mCustomerName, mTotalInvoiceAmount, mCashPaid, mChangeCash, mCreditCardNumber, mServerDate;
42 |
43 |
44 | /**
45 | * Constrcutor
46 | * @param context activity context
47 | */
48 | public AdapterViewPayment(Context context) {
49 | super(context);
50 | initView(context);
51 | }
52 |
53 | /**
54 | * Constructor
55 | * @param context activity context
56 | * @param attrs AttributeSet object
57 | */
58 | public AdapterViewPayment(Context context, AttributeSet attrs) {
59 | super(context, attrs);
60 | initView(context);
61 | }
62 |
63 | private void initView(Context context){
64 |
65 | // Initialize the layout file which is the root view of all widgets
66 | View view = inflate(context, R.layout.adapter_view_payment, this);
67 |
68 | mRoot = (LinearLayout) view.findViewById(R.id.root);
69 | mCustomerName = (TextView) view.findViewById(R.id.payment_customer_name);
70 | mTotalInvoiceAmount = (TextView) view.findViewById(R.id.payment_total_invoice_amount);
71 | mCashPaid = (TextView) view.findViewById(R.id.payment_cash_paid);
72 | mChangeCash = (TextView) view.findViewById(R.id.payment_change_cash);
73 | mCreditCardNumber = (TextView) view.findViewById(R.id.payment_credit_card_number);
74 | mServerDate = (TextView) view.findViewById(R.id.payment_server_date);
75 |
76 | }
77 |
78 |
79 | public LinearLayout getmRoot() {
80 | return mRoot;
81 | }
82 |
83 | public void setmRoot(LinearLayout mRoot) {
84 | this.mRoot = mRoot;
85 | }
86 |
87 | public TextView getmCustomerName() {
88 | return mCustomerName;
89 | }
90 |
91 | public void setmCustomerName(TextView mCustomerName) {
92 | this.mCustomerName = mCustomerName;
93 | }
94 |
95 | public TextView getmTotalInvoiceAmount() {
96 | return mTotalInvoiceAmount;
97 | }
98 |
99 | public void setmTotalInvoiceAmount(TextView mTotalInvoiceAmount) {
100 | this.mTotalInvoiceAmount = mTotalInvoiceAmount;
101 | }
102 |
103 | public TextView getmCashPaid() {
104 | return mCashPaid;
105 | }
106 |
107 | public void setmCashPaid(TextView mCashPaid) {
108 | this.mCashPaid = mCashPaid;
109 | }
110 |
111 | public TextView getmChangeCash() {
112 | return mChangeCash;
113 | }
114 |
115 | public void setmChangeCash(TextView mChangeCash) {
116 | this.mChangeCash = mChangeCash;
117 | }
118 |
119 | public TextView getmCreditCardNumber() {
120 | return mCreditCardNumber;
121 | }
122 |
123 | public void setmCreditCardNumber(TextView mCreditCardNumber) {
124 | this.mCreditCardNumber = mCreditCardNumber;
125 | }
126 |
127 | public TextView getmServerDate() {
128 | return mServerDate;
129 | }
130 |
131 | public void setmServerDate(TextView mServerDate) {
132 | this.mServerDate = mServerDate;
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/salespack/paidpack/PaymentActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.salespack.paidpack;
26 |
27 | import android.content.Context;
28 | import android.content.Intent;
29 | import android.support.annotation.Nullable;
30 | import android.os.Bundle;
31 | import android.support.v7.widget.Toolbar;
32 | import android.view.View;
33 | import android.widget.FrameLayout;
34 |
35 | import com.stockita.stockitapointofsales.R;
36 | import com.stockita.stockitapointofsales.activities.BaseActivity;
37 |
38 | import butterknife.Bind;
39 | import butterknife.ButterKnife;
40 |
41 |
42 | /**
43 | * This is the activity that will host the PaymentFragment
44 | */
45 | public class PaymentActivity extends BaseActivity {
46 |
47 |
48 | private static final String TAG_LOG = PaymentActivity.class.getSimpleName();
49 | private static final String KEY_ONE = TAG_LOG + ".KEY_ONE";
50 | private static final String KEY_TWO = TAG_LOG + ".KEY_TWO";
51 |
52 | @Bind(R.id.toolbar)
53 | Toolbar toolbar;
54 |
55 | @Bind(R.id.container)
56 | FrameLayout container;
57 |
58 |
59 | /**
60 | * Factory method to call this activity from
61 | * {@link com.stockita.stockitapointofsales.activities.SecondActivity#callPaymentActivity(String, String)}
62 | * @param context The Activity context
63 | * @param userUid The user's uid
64 | * @param paidSalesHeaderKey The push() key for sales header
65 | */
66 | public static void paymentActivity(Context context, String userUid, String paidSalesHeaderKey) {
67 |
68 | Intent intent = new Intent(context, PaymentActivity.class);
69 | Bundle bundle = new Bundle();
70 | bundle.putString(KEY_ONE, userUid);
71 | bundle.putString(KEY_TWO, paidSalesHeaderKey);
72 | intent.putExtras(bundle);
73 | context.startActivity(intent);
74 |
75 | }
76 |
77 |
78 | @Override
79 | protected void onCreate(Bundle savedInstanceState) {
80 | super.onCreate(savedInstanceState);
81 | setContentView(R.layout.activity_payment);
82 |
83 | // ButterKnife
84 | ButterKnife.bind(this);
85 |
86 | // toolbar
87 | setSupportActionBar(toolbar);
88 |
89 |
90 | // Show the back button on the top left
91 | if (toolbar != null) {
92 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
93 | }
94 |
95 | // When user press the back arrow on the toolbar it will hit the back button
96 | if (toolbar != null) {
97 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {
98 | @Override
99 | public void onClick(View view) {
100 | onBackPressed();
101 | }
102 | });
103 | }
104 |
105 | if (savedInstanceState == null) {
106 |
107 | Bundle bundle = getIntent().getExtras();
108 |
109 | String userUid = bundle.getString(KEY_ONE);
110 | String paidSalesHeaderKey = bundle.getString(KEY_TWO);
111 |
112 | PaymentFragment fragment = PaymentFragment.newInstance(userUid, paidSalesHeaderKey);
113 |
114 | getFragmentManager().beginTransaction()
115 | .replace(R.id.container, fragment)
116 | .commit();
117 |
118 | }
119 | }
120 |
121 | @Override
122 | protected void onPostCreate(@Nullable Bundle savedInstanceState) {
123 | super.onPostCreate(savedInstanceState);
124 |
125 |
126 | // toolbar title & subtitle
127 | toolbar.setTitle("Stockita Point of Sale");
128 | toolbar.setSubtitle("Payment Detail");
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 |
7 | 16dp
8 | 16dp
9 | 16dp
10 |
11 |
12 | 4dp
13 |
14 | 2
15 | false
16 | false
17 |
18 |
19 |
20 | 16dp
21 |
22 |
23 | 4dp
24 | 4dp
25 | 4dp
26 | 4dp
27 |
28 |
29 | 232dp
30 | 176dp
31 | 8dp
32 | 12sp
33 | 8sp
34 |
35 |
36 | 400dp
37 | 232dp
38 | 176dp
39 | 8dp
40 | 12sp
41 | 8sp
42 |
43 |
44 | 16dp
45 | 8dp
46 |
47 |
48 | 4dp
49 | 8dp
50 |
51 |
52 | 4dp
53 | 8dp
54 | 16dp
55 |
56 |
57 | 4dp
58 | 8dp
59 | 16dp
60 |
61 |
62 | 4dp
63 | 8dp
64 | 16dp
65 |
66 |
67 | 4dp
68 | 8dp
69 | 12dp
70 | 16dp
71 | 32dp
72 |
73 |
74 | 200dp
75 |
76 |
77 | 4dp
78 | 8dp
79 | 12dp
80 | 16dp
81 | 32dp
82 | 64dp
83 |
84 |
85 | 4dp
86 | 8dp
87 | 12dp
88 | 16dp
89 | 32dp
90 | 64dp
91 |
92 |
93 | 16dp
94 | 32dp
95 |
96 |
97 | 16dp
98 |
99 |
100 | 8dp
101 |
102 |
103 | 8dp
104 |
105 |
106 | 56dp
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/data/UserModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.data;
26 |
27 | import android.os.Parcel;
28 | import android.os.Parcelable;
29 |
30 | import com.google.firebase.database.Exclude;
31 | import com.google.firebase.database.ServerValue;
32 | import com.stockita.stockitapointofsales.utilities.Constants;
33 |
34 | import java.util.HashMap;
35 |
36 | /**
37 | * This is a POJO for the user model profile object
38 | */
39 | public class UserModel implements Parcelable {
40 |
41 | /**
42 | * States
43 | */
44 | private String userName;
45 | private String uid;
46 | private String userEmail;
47 | private String photoUrl;
48 |
49 | private HashMap dateCreated;
50 |
51 | private boolean status;
52 |
53 |
54 | /**
55 | * Empty constructor
56 | */
57 | public UserModel(){
58 |
59 | }
60 |
61 |
62 | /**
63 | * Constructor
64 | * @param userName Get the user name
65 | * @param uid Get the user UID
66 | * @param userEmail Get the user email address
67 | * @param photoUrl Get the user photo
68 | */
69 | public UserModel(String userName, String uid, String userEmail, String photoUrl, HashMap dateCreated) {
70 | this.userName = userName;
71 | this.userEmail = userEmail;
72 | this.uid = uid;
73 | this.photoUrl = photoUrl;
74 | this.dateCreated = dateCreated;
75 |
76 | }
77 |
78 | public String getUserName() {
79 | return userName;
80 | }
81 |
82 | public void setUserName(String userName) {
83 | this.userName = userName;
84 | }
85 |
86 | public String getUid() {
87 | return uid;
88 | }
89 |
90 | public void setUid(String uid) {
91 | this.uid = uid;
92 | }
93 |
94 | public String getUserEmail() {
95 | return userEmail;
96 | }
97 |
98 | public void setUserEmail(String userEmail) {
99 | this.userEmail = userEmail;
100 | }
101 |
102 | public HashMap getDateCreated() {
103 | return dateCreated;
104 | }
105 |
106 | public void setDateCreated(HashMap dateCreated) {
107 | this.dateCreated = dateCreated;
108 | }
109 |
110 | public boolean isStatus() {
111 | return status;
112 | }
113 |
114 | public void setStatus(boolean status) {
115 | this.status = status;
116 | }
117 |
118 | public String getPhotoUrl() {
119 | return photoUrl;
120 | }
121 |
122 | public void setPhotoUrl(String photoUrl) {
123 | this.photoUrl = photoUrl;
124 | }
125 |
126 | @Exclude
127 | public long getDateCreatedLong() {
128 | return (long)dateCreated.get(Constants.FIREBASE_PROPERTY_TIMESTAMP);
129 | }
130 |
131 |
132 |
133 | protected UserModel(Parcel in) {
134 | userName = in.readString();
135 | uid = in.readString();
136 | userEmail = in.readString();
137 | photoUrl = in.readString();
138 | dateCreated = (HashMap) in.readValue(HashMap.class.getClassLoader());
139 | }
140 |
141 | @Override
142 | public int describeContents() {
143 | return 0;
144 | }
145 |
146 | @Override
147 | public void writeToParcel(Parcel dest, int flags) {
148 | dest.writeString(userName);
149 | dest.writeString(uid);
150 | dest.writeString(userEmail);
151 | dest.writeString(photoUrl);
152 | dest.writeValue(dateCreated);
153 | }
154 |
155 | @SuppressWarnings("unused")
156 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
157 | @Override
158 | public UserModel createFromParcel(Parcel in) {
159 | return new UserModel(in);
160 | }
161 |
162 | @Override
163 | public UserModel[] newArray(int size) {
164 | return new UserModel[size];
165 | }
166 | };
167 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/stockita/stockitapointofsales/salespack/paidpack/PaidSalesDetailActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MIT License
3 | *
4 | * Copyright (c) 2016 Hishmad Abubakar Al-Amudi
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package com.stockita.stockitapointofsales.salespack.paidpack;
26 |
27 | import android.content.Context;
28 | import android.content.Intent;
29 | import android.os.Bundle;
30 | import android.support.annotation.Nullable;
31 | import android.support.design.widget.FloatingActionButton;
32 | import android.support.design.widget.Snackbar;
33 | import android.support.v7.app.AppCompatActivity;
34 | import android.support.v7.widget.Toolbar;
35 | import android.util.Log;
36 | import android.view.View;
37 | import android.widget.FrameLayout;
38 |
39 | import com.stockita.stockitapointofsales.R;
40 | import com.stockita.stockitapointofsales.activities.BaseActivity;
41 |
42 | import butterknife.Bind;
43 | import butterknife.ButterKnife;
44 |
45 | /**
46 | * This is the activity that host the {@link PaidSalesDetailFragmentUI}
47 | */
48 | public class PaidSalesDetailActivity extends BaseActivity {
49 |
50 | private static final String TAG_LOG = PaidSalesDetailActivity.class.getSimpleName();
51 | private static final String KEY_ONE = TAG_LOG + ".KEY_ONE";
52 | private static final String KEY_TWO = TAG_LOG + ".KEY_TWO";
53 |
54 | @Bind(R.id.toolbar)
55 | Toolbar toolbar;
56 |
57 | @Bind(R.id.container)
58 | FrameLayout container;
59 |
60 |
61 | /**
62 | * Factory method to call this activity from
63 | * {@link com.stockita.stockitapointofsales.activities.SecondActivity#callPaidSalesDetailActivity(String, String)}
64 | * @param context The activity context
65 | * @param userUid The user's UID
66 | * @param paidSalesHeaderKey The push() key for the sales header
67 | */
68 | public static void paidSalesDetailActivity(Context context, String userUid, String paidSalesHeaderKey) {
69 |
70 | Intent intent = new Intent(context, PaidSalesDetailActivity.class);
71 | Bundle bundle = new Bundle();
72 | bundle.putString(KEY_ONE, userUid);
73 | bundle.putString(KEY_TWO, paidSalesHeaderKey);
74 | intent.putExtras(bundle);
75 | context.startActivity(intent);
76 |
77 | }
78 |
79 | @Override
80 | protected void onCreate(Bundle savedInstanceState) {
81 | super.onCreate(savedInstanceState);
82 | setContentView(R.layout.activity_paid_sales_detail);
83 |
84 | // ButterKnife
85 | ButterKnife.bind(this);
86 |
87 | // toolbar
88 | setSupportActionBar(toolbar);
89 |
90 |
91 | // Show the back button on the top left
92 | if (toolbar != null) {
93 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
94 | }
95 |
96 | // When user press the back arrow on the toolbar it will hit the back button
97 | if (toolbar != null) {
98 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {
99 | @Override
100 | public void onClick(View view) {
101 | onBackPressed();
102 | }
103 | });
104 | }
105 |
106 | if (savedInstanceState == null) {
107 |
108 | Bundle bundle = getIntent().getExtras();
109 |
110 | String userUid = bundle.getString(KEY_ONE);
111 | String paidSalesHeaderKey = bundle.getString(KEY_TWO);
112 |
113 |
114 | PaidSalesDetailFragmentUI fragment = PaidSalesDetailFragmentUI.newInstance(userUid, paidSalesHeaderKey);
115 |
116 | getFragmentManager().beginTransaction()
117 | .replace(R.id.container, fragment)
118 | .commit();
119 |
120 | }
121 |
122 | }
123 |
124 | @Override
125 | protected void onPostCreate(@Nullable Bundle savedInstanceState) {
126 | super.onPostCreate(savedInstanceState);
127 |
128 | // toolbar title & subtitle
129 | toolbar.setTitle("Stockita Point of Sale");
130 | toolbar.setSubtitle("Paid Sales Detail");
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
35 |
36 |
44 |
45 |
49 |
50 |
51 |
55 |
56 |
57 |
64 |
65 |
66 |
67 |
68 |
74 |
75 |
76 |
77 |
87 |
88 |
89 |
90 |
97 |
98 |
99 |
100 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_sales_detail_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
32 |
33 |
37 |
38 |
49 |
50 |
63 |
64 |
65 |
66 |
70 |
71 |
82 |
83 |
94 |
95 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_view_open_sales_detail_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
32 |
33 |
37 |
38 |
49 |
50 |
63 |
64 |
65 |
66 |
70 |
71 |
82 |
83 |
94 |
95 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------