-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from ekylibre/feature/reception/implement-new-…
…reception-activity Feature/reception/implement new reception activity
- Loading branch information
Showing
17 changed files
with
487 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/src/main/java/ekylibre/zero/reception/ArticleCodesDataModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Asus on 18/12/2017. | ||
*/ | ||
|
||
public class ArticleCodesDataModel implements Serializable { | ||
private String code; | ||
private int fk_article; | ||
private int id; | ||
private int ek_id; | ||
|
||
|
||
public ArticleCodesDataModel(String code,ArticleDataModel article, int id) { | ||
this.code = code; | ||
this.fk_article = article.getId(); | ||
this.id = id; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String nature) { | ||
this.code = code; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public int getFk_article() { | ||
return fk_article; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/ekylibre/zero/reception/ArticleDataModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Asus on 18/12/2017. | ||
*/ | ||
|
||
public class ArticleDataModel implements Serializable { | ||
private String nature; | ||
private String unity; | ||
private String name; | ||
private int id; | ||
private int ek_id; | ||
|
||
|
||
public ArticleDataModel(String nature, String unity, String name, int id) { | ||
this.nature = nature; | ||
this.unity = unity; | ||
this.name = name; | ||
this.id = id; | ||
|
||
} | ||
|
||
public String getNature() { | ||
return nature; | ||
} | ||
|
||
public void setNature(String nature) { | ||
this.nature = nature; | ||
} | ||
|
||
public String getUnity() { | ||
return unity; | ||
} | ||
|
||
public void setUnity(String unity) { | ||
this.unity = unity; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
|
||
} |
70 changes: 70 additions & 0 deletions
70
app/src/main/java/ekylibre/zero/reception/ArticleNewActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import android.content.ContentResolver; | ||
import android.content.ContentValues; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.res.Resources; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.Spinner; | ||
|
||
import ekylibre.database.ZeroContract; | ||
import ekylibre.zero.R; | ||
|
||
|
||
public class ArticleNewActivity extends AppCompatActivity implements View.OnClickListener { | ||
|
||
String[] natureList = {"Fertilizer", "Seed", "Chemical"}; | ||
String[] unityList = {"kg", "L", "t"}; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.article_new); | ||
|
||
Button btn_save = (Button) findViewById(R.id.buttonSaveArticleId); | ||
btn_save.setOnClickListener(this); | ||
Spinner spn_nat = (Spinner) findViewById(R.id.spinnerNatureArticleId); | ||
Spinner spn_uni = (Spinner) findViewById(R.id.spinnerUnityArticleId); | ||
ArrayAdapter<String> adapter_nature = new ArrayAdapter<String> | ||
(this, android.R.layout.simple_spinner_dropdown_item, natureList); | ||
spn_nat.setAdapter(adapter_nature); | ||
ArrayAdapter<String> adapter_unity = new ArrayAdapter<String> | ||
(this, android.R.layout.simple_spinner_dropdown_item, unityList); | ||
spn_uni.setAdapter(adapter_unity); | ||
} | ||
|
||
public void add_article(Context context) { | ||
//Article name, nature and unity add in data base | ||
ContentResolver contentResolver = context.getContentResolver(); | ||
ContentValues mNewValues = new ContentValues(); | ||
|
||
EditText newArticleName = (EditText) findViewById(R.id.editArticleNameId); | ||
|
||
Spinner SpinnerArticleNature = (Spinner) findViewById(R.id.spinnerNatureArticleId); | ||
Spinner SpinnerArticleUnity = (Spinner) findViewById(R.id.spinnerUnityArticleId); | ||
|
||
|
||
mNewValues.put(ZeroContract.Articles.NAME, newArticleName.getText().toString()); | ||
mNewValues.put(ZeroContract.Articles.NATURE, SpinnerArticleNature.getSelectedItem().toString()); | ||
mNewValues.put(ZeroContract.Articles.UNITY, SpinnerArticleUnity.getSelectedItem().toString()); | ||
contentResolver.insert(ZeroContract.Articles.CONTENT_URI, mNewValues); | ||
} | ||
|
||
@Override | ||
public void onClick(View _buttonView) { | ||
//Récupère ce qu'a tapé l'utilisateur dans la zone de texte et la renvoie à la MainActivtity | ||
if (_buttonView.getId() == R.id.buttonSaveArticleId) { | ||
add_article(this); | ||
|
||
} | ||
} | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
app/src/main/java/ekylibre/zero/reception/ArticlePicturesDataModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import android.graphics.Picture; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Asus on 18/12/2017. | ||
*/ | ||
|
||
public class ArticlePicturesDataModel implements Serializable { | ||
private byte[] picture; | ||
private int fk_article; | ||
private int id; | ||
private int ek_id; | ||
|
||
|
||
public ArticlePicturesDataModel(byte[] picture, int id, ArticleDataModel article) { | ||
this.picture = picture; | ||
this.id = id; | ||
this.fk_article = article.getId(); | ||
|
||
} | ||
|
||
public byte[] getPicture() { | ||
return picture; | ||
} | ||
|
||
public void setPicture(String nature) { | ||
this.picture = picture; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public int getFk_article() { | ||
return fk_article; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/ekylibre/zero/reception/ReceptionActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import android.content.Context; | ||
import android.database.ContentObserver; | ||
import android.database.DatabaseUtils; | ||
|
||
import java.util.ArrayList; | ||
|
||
import ekylibre.database.ZeroProvider; | ||
|
||
/** | ||
* Created by Asus on 18/12/2017. | ||
*/ | ||
|
||
public class ReceptionActivity { | ||
ArrayList<ReceptionDataModel> receptionDataModels; | ||
|
||
public long getTaskCount(long tasklist_id) { | ||
return DatabaseUtils.queryNumEntries(db, TABLE_NAME); | ||
} | ||
|
||
public void loadata(Context context) { | ||
receptionDataModels = new ArrayList<ReceptionDataModel>(); | ||
ContentObserver receptionContentResolverObserver = null; | ||
getContentResolver().delete(ZeroProvider.Contract.CONTENT_URI, null, null); | ||
for (int i = 0; i < 10; i++) { | ||
|
||
|
||
} | ||
|
||
|
||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/ekylibre/zero/reception/ReceptionDataModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Asus on 18/12/2017. | ||
*/ | ||
|
||
public class ReceptionDataModel implements Serializable { | ||
private int id; | ||
private String received_at; | ||
private int fk_supplier; | ||
private String reception_number; | ||
private int ek_id; | ||
|
||
|
||
public ReceptionDataModel(String received_at, String reception_number, SupplierDataModel supplier, int id) { | ||
this.received_at = received_at; | ||
this.reception_number = reception_number; | ||
this.fk_supplier = supplier.getId(); | ||
this.id = id; | ||
} | ||
|
||
public String getReceived_at() { | ||
return received_at; | ||
} | ||
|
||
public void setReceived_at(String received_at) { | ||
this.received_at = received_at; | ||
} | ||
|
||
public String getReception_number() { | ||
return reception_number; | ||
} | ||
|
||
public void setReception_number(String reception_number) { | ||
this.reception_number = reception_number; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public int getFk_supplier() { | ||
return fk_supplier; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
app/src/main/java/ekylibre/zero/reception/ReceptionItemsDataModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ekylibre.zero.reception; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Pierre on 18/12/2017. | ||
*/ | ||
|
||
public class ReceptionItemsDataModel implements Serializable { | ||
private int id; | ||
private int fk_reception ; | ||
private int fk_article; | ||
private double quantity ; | ||
private int ek_id; | ||
|
||
public ReceptionItemsDataModel(int id, ReceptionDataModel reception, ArticleDataModel article, double quantity, int ek_id) { | ||
this.id = id; | ||
this.fk_reception = reception.getId() ; | ||
this.fk_article = article.getId(); | ||
this.quantity = quantity ; | ||
this.ek_id = ek_id; | ||
} | ||
|
||
public int getId() { | ||
|
||
return id; | ||
} | ||
|
||
public int getFk_reception() { | ||
return fk_reception; | ||
} | ||
|
||
|
||
|
||
public double getQuantity() { | ||
return quantity; | ||
} | ||
|
||
public void setQuantity(double quantity) { | ||
this.quantity = quantity; | ||
} | ||
|
||
public int getEk_id() { | ||
return ek_id; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.